|
|
@ -105,9 +105,6 @@ EXAMPLES = '''
|
|
|
|
end_time: 1395954406
|
|
|
|
end_time: 1395954406
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import urllib2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def post_annotation(module):
|
|
|
|
def post_annotation(module):
|
|
|
|
user = module.params['user']
|
|
|
|
user = module.params['user']
|
|
|
|
api_key = module.params['api_key']
|
|
|
|
api_key = module.params['api_key']
|
|
|
@ -134,10 +131,9 @@ def post_annotation(module):
|
|
|
|
headers = {}
|
|
|
|
headers = {}
|
|
|
|
headers['Content-Type'] = 'application/json'
|
|
|
|
headers['Content-Type'] = 'application/json'
|
|
|
|
headers['Authorization'] = "Basic " + base64.b64encode(user + ":" + api_key).strip()
|
|
|
|
headers['Authorization'] = "Basic " + base64.b64encode(user + ":" + api_key).strip()
|
|
|
|
req = urllib2.Request(url, json_body, headers)
|
|
|
|
|
|
|
|
try:
|
|
|
|
response, info = fetch_url(module, url, data=json_body, headers=headers)
|
|
|
|
response = urllib2.urlopen(req)
|
|
|
|
if info['status'] != 200:
|
|
|
|
except urllib2.HTTPError, e:
|
|
|
|
|
|
|
|
module.fail_json(msg="Request Failed", reason=e.reason)
|
|
|
|
module.fail_json(msg="Request Failed", reason=e.reason)
|
|
|
|
response = response.read()
|
|
|
|
response = response.read()
|
|
|
|
module.exit_json(changed=True, annotation=response)
|
|
|
|
module.exit_json(changed=True, annotation=response)
|
|
|
@ -161,4 +157,6 @@ def main():
|
|
|
|
post_annotation(module)
|
|
|
|
post_annotation(module)
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.basic import *
|
|
|
|
from ansible.module_utils.basic import *
|
|
|
|
main()
|
|
|
|
from ansible.module_utils.urls import *
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
|
|
main()
|
|
|
|