...
|
...
|
@@ -55,7 +55,7 @@ class consoleRobot(object): |
|
|
"Action":"TerminateInstances",
|
|
|
"InstanceIds.0":instanceId
|
|
|
}
|
|
|
result = self.client.do_query(params,"cvm.ap-beijing.tencentcloudapi.com")
|
|
|
result = self.client.do_query(params,"cvm.ap-beijing.tencentcloudapi.com",api_version=3)
|
|
|
return result
|
|
|
|
|
|
def ReturnInstanceByIp(self,privateIp):
|
...
|
...
|
@@ -67,11 +67,16 @@ class consoleRobot(object): |
|
|
feedBack = str(raw_input('确认?(Y/N): ')).upper()
|
|
|
if feedBack == 'Y':
|
|
|
print '开始退还实例...{0}'.format(instanceId)
|
|
|
self.ReturnInstanceById(instanceId)
|
|
|
print '实例退还成功!'
|
|
|
print '开始注销zabbix host...'
|
|
|
delete_host_by_ip(privateIp)
|
|
|
return 0
|
|
|
rsp = self.ReturnInstanceById(instanceId)['Response']
|
|
|
if rsp.has_key('Error'):
|
|
|
print json.dumps(rsp['Error'],indent=4)
|
|
|
print '实例退还失败'
|
|
|
return 1
|
|
|
else:
|
|
|
print '实例退还成功!'
|
|
|
print '开始注销zabbix host...'
|
|
|
delete_host_by_ip(privateIp)
|
|
|
return 0
|
|
|
else:
|
|
|
print '任务取消'
|
|
|
return 0
|
...
|
...
|
|