diff options
author | Mike Crute <mike@crute.us> | 2019-02-17 03:11:51 +0000 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2019-02-17 03:11:51 +0000 |
commit | 667b5707f75836c59aa526a8dafd0b099366ef7c (patch) | |
tree | d73655601db178df8fe61e2a621c029f7737c06b /ping_tester | |
parent | 776709255538ac65188cc23d320d3141c03857e0 (diff) | |
download | dockerfiles-667b5707f75836c59aa526a8dafd0b099366ef7c.tar.bz2 dockerfiles-667b5707f75836c59aa526a8dafd0b099366ef7c.tar.xz dockerfiles-667b5707f75836c59aa526a8dafd0b099366ef7c.zip |
ping_test: Don't error if ping fails
Diffstat (limited to 'ping_tester')
-rwxr-xr-x | ping_tester/ping_test.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ping_tester/ping_test.py b/ping_tester/ping_test.py index 6e19b3f..f6b7238 100755 --- a/ping_tester/ping_test.py +++ b/ping_tester/ping_test.py | |||
@@ -28,7 +28,12 @@ def main(sample_count=5): | |||
28 | ["ping", "-c", str(sample_count), hostname], | 28 | ["ping", "-c", str(sample_count), hostname], |
29 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) | 29 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
30 | 30 | ||
31 | val = patt.search(out.stdout.decode("us-ascii")).groupdict() | 31 | # Prevent failing with an error if the ping fails |
32 | match = patt.search(out.stdout.decode("us-ascii")) | ||
33 | if not match: | ||
34 | return 1 | ||
35 | |||
36 | val = match.groupdict() | ||
32 | 37 | ||
33 | client.put_metric_data( | 38 | client.put_metric_data( |
34 | Namespace="VPNLatency", | 39 | Namespace="VPNLatency", |
@@ -91,6 +96,8 @@ def main(sample_count=5): | |||
91 | ] | 96 | ] |
92 | ) | 97 | ) |
93 | 98 | ||
99 | return 0 | ||
100 | |||
94 | 101 | ||
95 | if __name__ == "__main__": | 102 | if __name__ == "__main__": |
96 | main() | 103 | sys.exit(main()) |