summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-03-19 10:35:13 -0400
committerScott Moser <smoser@ubuntu.com>2013-03-19 10:35:13 -0400
commit0d325536ea06a8511da04f57260ab08e8b4786d9 (patch)
treef855703c705b338b9b5858d3a29e812da9825f6b
parent92b23e3d27623440b3b37ccb9d865b235a99f5f1 (diff)
downloadvyos-cloud-init-0d325536ea06a8511da04f57260ab08e8b4786d9.tar.gz
vyos-cloud-init-0d325536ea06a8511da04f57260ab08e8b4786d9.zip
make get_instance_userdata and get_instance_metadata more like botos
this shouldn't change anything, only the signatures of the methods.
-rw-r--r--cloudinit/ec2_utils.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/cloudinit/ec2_utils.py b/cloudinit/ec2_utils.py
index 6b2754aa..87644c40 100644
--- a/cloudinit/ec2_utils.py
+++ b/cloudinit/ec2_utils.py
@@ -135,8 +135,9 @@ class MetadataMaterializer(object):
return joined
-def get_instance_userdata(api_version, metadata_address, ssl_details=None):
- ud_url = combine_url(metadata_address, api_version)
+def get_instance_userdata(version='latest', url='http://169.254.169.254',
+ ssl_details=None):
+ ud_url = combine_url(url, version)
ud_url = combine_url(ud_url, 'user-data')
try:
response = util.read_file_or_url(ud_url, ssl_details=ssl_details)
@@ -146,11 +147,13 @@ def get_instance_userdata(api_version, metadata_address, ssl_details=None):
return None
-def get_instance_metadata(api_version, metadata_address, ssl_details=None):
- md_url = combine_url(metadata_address, api_version)
+def get_instance_metadata(version='latest', url='http://169.254.169.254',
+ ssl_details=None, timeout=5, num_retries=5)
+ md_url = combine_url(metadata_address, version)
md_url = combine_url(md_url, 'meta-data')
try:
- response = util.read_file_or_url(md_url, ssl_details=ssl_details)
+ response = util.read_file_or_url(md_url, ssl_details=ssl_details,
+ timeout=timeout, retries=num_retries)
materializer = MetadataMaterializer(str(response), md_url, ssl_details)
return materializer.materialize()
except Exception: