脚本不再负责resolv文件刷新 交由tower schedule处理
Showing
1 changed file
with
24 additions
and
23 deletions
@@ -124,29 +124,30 @@ class EMRClusterScanner(object): | @@ -124,29 +124,30 @@ class EMRClusterScanner(object): | ||
124 | return True | 124 | return True |
125 | 125 | ||
126 | def syncDNS(self,target='emr-recom'): | 126 | def syncDNS(self,target='emr-recom'): |
127 | - if target == 'emr-recom': #目前只负责同步emr-recom的DNS | ||
128 | - cmd = 'ansible-playbook -i {0} {1}'.format(self.inventoryFile,self.playbook_resolv) | ||
129 | - retry = 3 | ||
130 | - while retry > 0: | ||
131 | - print cmd | ||
132 | - output = os.popen(cmd).read() | ||
133 | - if 'unreachable=1' in output or 'failed=1' in output: | ||
134 | - with open('/var/log/supervisor/ansible.err','a') as f: | ||
135 | - f.write(output+'\n\n') | ||
136 | - f.close() | ||
137 | - retry-=1 | ||
138 | - print "重新同步DNS...还剩{0}次".format(retry) | ||
139 | - time.sleep(300) | ||
140 | - continue | ||
141 | - else: | ||
142 | - with open('/var/log/supervisor/ansible.log','a') as f: | ||
143 | - f.write(output+'\n\n') | ||
144 | - f.close() | ||
145 | - print "DNS 同步成功" | ||
146 | - return True | ||
147 | - return False | ||
148 | - else: | ||
149 | - return True | 127 | + return True #脚本不再负责resolv文件刷新 交由tower schedule处理 |
128 | + #if target == 'emr-recom': #目前只负责同步emr-recom的DNS | ||
129 | + # cmd = 'ansible-playbook -i {0} {1}'.format(self.inventoryFile,self.playbook_resolv) | ||
130 | + # retry = 3 | ||
131 | + # while retry > 0: | ||
132 | + # print cmd | ||
133 | + # output = os.popen(cmd).read() | ||
134 | + # if 'unreachable=1' in output or 'failed=1' in output: | ||
135 | + # with open('/var/log/supervisor/ansible.err','a') as f: | ||
136 | + # f.write(output+'\n\n') | ||
137 | + # f.close() | ||
138 | + # retry-=1 | ||
139 | + # print "重新同步DNS...还剩{0}次".format(retry) | ||
140 | + # time.sleep(300) | ||
141 | + # continue | ||
142 | + # else: | ||
143 | + # with open('/var/log/supervisor/ansible.log','a') as f: | ||
144 | + # f.write(output+'\n\n') | ||
145 | + # f.close() | ||
146 | + # print "DNS 同步成功" | ||
147 | + # return True | ||
148 | + # return False | ||
149 | + #else: | ||
150 | + # return True | ||
150 | 151 | ||
151 | def checkDNS(self): | 152 | def checkDNS(self): |
152 | check_cmd = 'ansible-playbook -i {0} {1} --check'.format(self.inventoryFile,self.playbook_resolv) | 153 | check_cmd = 'ansible-playbook -i {0} {1} --check'.format(self.inventoryFile,self.playbook_resolv) |
-
Please register or login to post a comment