]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat : boto_client_cloudwatch allow credentials override
authorSteven Hardy <shardy@redhat.com>
Mon, 8 Oct 2012 12:48:27 +0000 (13:48 +0100)
committerSteven Hardy <shardy@redhat.com>
Tue, 16 Oct 2012 13:18:09 +0000 (14:18 +0100)
Allow the AWS key/secret to be passed in when making the client
connection like boto_client.py

Ref #222

Change-Id: Iee24120eb52c8ffb97b1b421b0a27313e5f5cbdd
Signed-off-by: Steven Hardy <shardy@redhat.com>
heat/boto_client_cloudwatch.py

index 27d3e0da4d2f0fefd0bcc67f3b513b0b79ad2240..76f0199aa8a33b5e35c080a7b53968edc4f328c5 100644 (file)
@@ -189,7 +189,7 @@ class BotoCWClient(CloudWatchConnection):
         return '\n'.join(ret)
 
 
-def get_client(port=None):
+def get_client(port=None, aws_access_key=None, aws_secret_key=None):
     """
     Returns a new boto CloudWatch client connection to a heat server
     Note : Configuration goes in /etc/boto.cfg, not via arguments
@@ -198,8 +198,8 @@ def get_client(port=None):
     # Note we pass None/None for the keys so boto reads /etc/boto.cfg
     # Also note is_secure is defaulted to False as HTTPS connections
     # don't seem to work atm, FIXME
-    cloudwatch = BotoCWClient(aws_access_key_id=None,
-        aws_secret_access_key=None, is_secure=False,
+    cloudwatch = BotoCWClient(aws_access_key_id=aws_access_key,
+        aws_secret_access_key=aws_secret_key, is_secure=False,
         port=port, path="/v1")
     if cloudwatch:
         logger.debug("Got CW connection object OK")