Remove redundant print
Showing
1 changed file
with
7 additions
and
1 deletions
@@ -130,12 +130,18 @@ class EMRClusterScanner(object): | @@ -130,12 +130,18 @@ class EMRClusterScanner(object): | ||
130 | while retry > 0: | 130 | while retry > 0: |
131 | print cmd | 131 | print cmd |
132 | output = os.popen(cmd).read() | 132 | output = os.popen(cmd).read() |
133 | - if 'changed=1' not in output or 'unreachable=1' in output: | 133 | + if 'unreachable=1' in output or 'failed=1' in output or 'changed=1' not in output: |
134 | + with open('/var/log/supervisor/ansible.err','a') as f: | ||
135 | + f.write(output+'\n\n') | ||
136 | + f.close() | ||
134 | retry-=1 | 137 | retry-=1 |
135 | print "重新同步DNS...还剩{0}次".format(retry) | 138 | print "重新同步DNS...还剩{0}次".format(retry) |
136 | time.sleep(300) | 139 | time.sleep(300) |
137 | continue | 140 | continue |
138 | else: | 141 | else: |
142 | + with open('/var/log/supervisor/ansible.log','a') as f: | ||
143 | + f.write(output+'\n\n') | ||
144 | + f.close() | ||
139 | print "DNS 同步成功" | 145 | print "DNS 同步成功" |
140 | return True | 146 | return True |
141 | return False | 147 | return False |
-
Please register or login to post a comment