...
|
...
|
@@ -30,7 +30,7 @@ class EMRClusterScanner(object): |
|
|
self.inventoryFile = '{0}inventories/bigdata/hosts'.format(self.workDir)
|
|
|
self.playbook_resolv = '{0}playbooks/resolv.yml'.format(self.workDir)
|
|
|
self.mailman = mailman()
|
|
|
self.receivers = ['tiexin.yang@yoho.cn','chunhua.zhang@yoho.cn']
|
|
|
self.receivers = ['tiexin.yang@yoho.cn']#,'chunhua.zhang@yoho.cn']
|
|
|
self.emrNameMap = {
|
|
|
"emr-rt": "emr-r6bhtb5v",
|
|
|
"emr-ops": "emr-iaeloyc2",
|
...
|
...
|
@@ -128,11 +128,17 @@ class EMRClusterScanner(object): |
|
|
def syncDNS(self,target='emr-recom'):
|
|
|
if target == 'emr-recom': #目前只负责同步emr-recom的DNS
|
|
|
cmd = 'ansible-playbook -i {0} {1}'.format(self.inventoryFile,self.playbook_resolv)
|
|
|
output = os.popen(cmd).read()
|
|
|
if 'changed=1' not in output or 'unreachable=1' in output:
|
|
|
return False
|
|
|
else:
|
|
|
return True
|
|
|
retry = 3
|
|
|
while retry > 0:
|
|
|
output = os.popen(cmd).read()
|
|
|
if 'changed=1' not in output or 'unreachable=1' in output:
|
|
|
retry-=1
|
|
|
print "重新同步DNS...还剩{0}次".format(retry)
|
|
|
time.sleep(300)
|
|
|
continue
|
|
|
else:
|
|
|
return True
|
|
|
return False
|
|
|
else:
|
|
|
return True
|
|
|
|
...
|
...
|
|