diff options
author | Yujun Zhang <zhang.yujunz@zte.com.cn> | 2016-08-07 06:30:47 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-08-07 06:30:47 +0000 |
commit | c11e4c98bb3418373652f985240c1e2a30285565 (patch) | |
tree | c0acc94eff836f15c87e71ac76437746926a9d6b | |
parent | dd0a00b503f1d6e8d43d30646ffc2642bb04fe93 (diff) | |
parent | 989f1b4aaa86581781ee7f7ebc711c5338ef6dc7 (diff) |
Merge "Add parameter attempts in ping_test()"
-rw-r--r-- | func/env_setup.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/func/env_setup.py b/func/env_setup.py index 9c0dadb3..f59883a0 100644 --- a/func/env_setup.py +++ b/func/env_setup.py @@ -98,16 +98,18 @@ class Env_setup: print 'Retrying SSH %s' % infinity @staticmethod - def ping_test(lister): - + def ping_test(lister, attempts=30): for k, v in lister.iteritems(): time.sleep(10) for val in v: ipvar = val ping_cmd = 'ping -D -c1 {0}'.format(ipvar) - while os.system(ping_cmd) != 0: - print '\nWaiting for machine\n' - time.sleep(10) + for i in range(attempts): + if os.system(ping_cmd) != 0: + print '\nWaiting for machine\n' + time.sleep(10) + else: + break print ('\n\n %s is UP \n\n ' % ipvar) def get_host_machine_info(self, host_tag): |