Merge remote-tracking branch 'upstream/devel' into devel

reviewable/pr18780/r1
Kristian Koehntopp 9 years ago
commit d0e3c882f9

@ -213,9 +213,9 @@ def create_eni(connection, module):
except BotoServerError as ex:
eni.delete()
raise
changed = True
# Wait to allow creation / attachment to finish
wait_for_eni(eni, "attached")
changed = True
eni.update()
except BotoServerError as e:

@ -326,7 +326,7 @@ class AnsibleCloudStackAccount(AnsibleCloudStack):
if not self.module.check_mode:
res = self.cs.deleteAccount(id=account['id'])
if 'errortext' in account:
if 'errortext' in res:
self.module.fail_json(msg="Failed: '%s'" % res['errortext'])
poll_async = self.module.params.get('poll_async')

@ -145,6 +145,12 @@ LOGIN_HOST['vca'] = 'vca.vmware.com'
LOGIN_HOST['vchs'] = 'vchs.vmware.com'
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):
service_type = module.params.get('service_type')
username = module.params.get('username')

@ -72,14 +72,14 @@ def do_request(module, url, params, headers=None):
raise exc
return r
def get_access_token(client_id, client_secret):
def get_access_token(module, client_id, client_secret):
params = {
'client_id': client_id,
'client_secret': client_secret,
'grant_type': 'client_credentials',
'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']
@ -88,7 +88,7 @@ def send_message(module, client_id, client_secret, topic, msg):
send message to typetalk
"""
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
headers = {
'Authorization': 'Bearer %s' % access_token,

Loading…
Cancel
Save