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