Merge remote-tracking branch 'upstream/devel' into devel
This commit is contained in:
commit
d0e3c882f9
4 changed files with 18 additions and 12 deletions
|
@ -213,9 +213,9 @@ def create_eni(connection, module):
|
||||||
except BotoServerError as ex:
|
except BotoServerError as ex:
|
||||||
eni.delete()
|
eni.delete()
|
||||||
raise
|
raise
|
||||||
changed = True
|
|
||||||
# Wait to allow creation / attachment to finish
|
# Wait to allow creation / attachment to finish
|
||||||
wait_for_eni(eni, "attached")
|
wait_for_eni(eni, "attached")
|
||||||
|
changed = True
|
||||||
eni.update()
|
eni.update()
|
||||||
|
|
||||||
except BotoServerError as e:
|
except BotoServerError as e:
|
||||||
|
|
|
@ -326,7 +326,7 @@ class AnsibleCloudStackAccount(AnsibleCloudStack):
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
res = self.cs.deleteAccount(id=account['id'])
|
res = self.cs.deleteAccount(id=account['id'])
|
||||||
|
|
||||||
if 'errortext' in account:
|
if 'errortext' in res:
|
||||||
self.module.fail_json(msg="Failed: '%s'" % res['errortext'])
|
self.module.fail_json(msg="Failed: '%s'" % res['errortext'])
|
||||||
|
|
||||||
poll_async = self.module.params.get('poll_async')
|
poll_async = self.module.params.get('poll_async')
|
||||||
|
|
|
@ -145,6 +145,12 @@ LOGIN_HOST['vca'] = 'vca.vmware.com'
|
||||||
LOGIN_HOST['vchs'] = 'vchs.vmware.com'
|
LOGIN_HOST['vchs'] = 'vchs.vmware.com'
|
||||||
VALID_RULE_KEYS = ['rule_type', 'original_ip', 'original_port', 'translated_ip', 'translated_port', 'protocol']
|
VALID_RULE_KEYS = ['rule_type', 'original_ip', 'original_port', 'translated_ip', 'translated_port', 'protocol']
|
||||||
|
|
||||||
|
def serialize_instances(instance_list):
|
||||||
|
instances = []
|
||||||
|
for i in instance_list:
|
||||||
|
instances.append(dict(apiUrl=i['apiUrl'], instance_id=i['id']))
|
||||||
|
return instances
|
||||||
|
|
||||||
def vca_login(module=None):
|
def vca_login(module=None):
|
||||||
service_type = module.params.get('service_type')
|
service_type = module.params.get('service_type')
|
||||||
username = module.params.get('username')
|
username = module.params.get('username')
|
||||||
|
|
|
@ -72,14 +72,14 @@ def do_request(module, url, params, headers=None):
|
||||||
raise exc
|
raise exc
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def get_access_token(client_id, client_secret):
|
def get_access_token(module, client_id, client_secret):
|
||||||
params = {
|
params = {
|
||||||
'client_id': client_id,
|
'client_id': client_id,
|
||||||
'client_secret': client_secret,
|
'client_secret': client_secret,
|
||||||
'grant_type': 'client_credentials',
|
'grant_type': 'client_credentials',
|
||||||
'scope': 'topic.post'
|
'scope': 'topic.post'
|
||||||
}
|
}
|
||||||
res = do_request('https://typetalk.in/oauth2/access_token', params)
|
res = do_request(module, 'https://typetalk.in/oauth2/access_token', params)
|
||||||
return json.load(res)['access_token']
|
return json.load(res)['access_token']
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ def send_message(module, client_id, client_secret, topic, msg):
|
||||||
send message to typetalk
|
send message to typetalk
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
access_token = get_access_token(client_id, client_secret)
|
access_token = get_access_token(module, client_id, client_secret)
|
||||||
url = 'https://typetalk.in/api/v1/topics/%d' % topic
|
url = 'https://typetalk.in/api/v1/topics/%d' % topic
|
||||||
headers = {
|
headers = {
|
||||||
'Authorization': 'Bearer %s' % access_token,
|
'Authorization': 'Bearer %s' % access_token,
|
||||||
|
|
Loading…
Reference in a new issue