...
|
...
|
@@ -2,8 +2,9 @@ |
|
|
# -*- coding: UTF-8 -*-
|
|
|
# author tiexin.yang@yoho.cn
|
|
|
|
|
|
from qcloud.qcloud_api import QcloudApi
|
|
|
from qcloud.mailer import mailman
|
|
|
import sys
|
|
|
sys.path.append('../')
|
|
|
from lb_manager.qcloud.qcloud_api import QcloudApi
|
|
|
import json
|
|
|
import datetime
|
|
|
import argparse
|
...
|
...
|
@@ -29,7 +30,6 @@ class EMRClusterScanner(object): |
|
|
self.workDir = '/home/ansible/yoho-ansible-roles/'
|
|
|
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','kun.xiang@yoho.cn','chunhua.zhang@yoho.cn'] #已禁用
|
|
|
self.emrNameMap = {
|
|
|
"emr-rt": "emr-r6bhtb5v",
|
...
|
...
|
@@ -217,15 +217,12 @@ class EMRClusterScanner(object): |
|
|
continue
|
|
|
else:
|
|
|
print 'EMR大数据Inventory [{0}] 已更新\n{1}\n详见 http://git.yoho.cn/ops/yoho-ansible-roles/blob/master/inventories/bigdata/hosts'.format(emrName,result)
|
|
|
#self.mailman.mail(receivers=self.receivers,Content='EMR大数据Inventory [{0}] 已更新\n{1}\n详见 http://git.yoho.cn/ops/yoho-ansible-roles/blob/master/inventories/bigdata/hosts'.format(emrName,result),Title='EMR Inventory 更新结果')
|
|
|
else:
|
|
|
print 'EMR大数据Inventory更新失败\n请检查本地git缓存和ansible连接\n5分钟后重试'
|
|
|
#self.mailman.mail(receivers=self.receivers,Content='EMR大数据Inventory更新失败\n请检查本地git缓存和ansible连接\n5分钟后重试',Title='EMR Inventory 更新结果')
|
|
|
time.sleep(300)
|
|
|
continue
|
|
|
except Exception as e:
|
|
|
print e
|
|
|
#self.mailman.mail(receivers=self.receivers,Content='EMR大数据Inventory更新失败\n{0}\n5分钟后重试'.format(str(e)),Title='EMR Inventory 更新结果')
|
|
|
print 'EMR大数据Inventory更新失败\n{0}\n5分钟后重试'.format(str(e))
|
|
|
time.sleep(300)
|
|
|
pass
|
...
|
...
|
|