summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2015-07-28 10:49:18 -0700
committerToshio Kuratomi <toshio@fedoraproject.org>2015-07-28 10:51:13 -0700
commit4a43f52437b5568837925c6cbbc43927365e7d3e (patch)
tree133eb3f8db002d12e70a27f536b5bc1238f9c647
parent1d06ee6e2d6da6de158c538cf451aa075384c450 (diff)
downloadansible-modules-extras-4a43f52437b5568837925c6cbbc43927365e7d3e.tar.gz
Use fetch_url's basic auth instead of code specific to this module
-rw-r--r--monitoring/librato_annotation.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/monitoring/librato_annotation.py b/monitoring/librato_annotation.py
index 4927a9cf..f174bda0 100644
--- a/monitoring/librato_annotation.py
+++ b/monitoring/librato_annotation.py
@@ -20,8 +20,6 @@
#
-import base64
-
DOCUMENTATION = '''
---
module: librato_annotation
@@ -29,9 +27,8 @@ short_description: create an annotation in librato
description:
- Create an annotation event on the given annotation stream :name. If the annotation stream does not exist, it will be created automatically
version_added: "1.6"
-author: "Seth Edwards (@sedward)"
-requirements:
- - base64
+author: "Seth Edwards (@sedward)"
+requirements: []
options:
user:
description:
@@ -130,8 +127,10 @@ def post_annotation(module):
headers = {}
headers['Content-Type'] = 'application/json'
- headers['Authorization'] = "Basic " + base64.b64encode(user + ":" + api_key).strip()
+ # Hack send parameters the way fetch_url wants them
+ module.params['url_username'] = user
+ module.params['url_password'] = api_key
response, info = fetch_url(module, url, data=json_body, headers=headers)
if info['status'] != 200:
module.fail_json(msg="Request Failed", reason=e.reason)