diff options
author | Scott Moser <smoser@ubuntu.com> | 2011-06-01 16:29:37 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2011-06-01 16:29:37 -0400 |
commit | 5864b795eee242b1fd7c5910abce69a931bb8738 (patch) | |
tree | d90f834be44e2bb687bf61f95e658393bff6440a /cloudinit/boto_utils.py | |
parent | 80301e1a4aa1a7396b2cb2d6c5d0e46b75a46a98 (diff) | |
parent | b7dfa8c9b75c74208f134dfd15538601fedc0258 (diff) | |
download | vyos-cloud-init-5864b795eee242b1fd7c5910abce69a931bb8738.tar.gz vyos-cloud-init-5864b795eee242b1fd7c5910abce69a931bb8738.zip |
support configurable urls for metadata service
Now, if a Eucalyptus install is in STATIC or SYSTEM mode,
the metadata service can still be used. In order to do that,
the user must configure their DNS so that 'instance-data' will
resolve to the cloud controller.
Thanks to Kieran Evans.
LP: #761847
Diffstat (limited to 'cloudinit/boto_utils.py')
-rw-r--r-- | cloudinit/boto_utils.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cloudinit/boto_utils.py b/cloudinit/boto_utils.py index b38483fa..a2cb9ca6 100644 --- a/cloudinit/boto_utils.py +++ b/cloudinit/boto_utils.py @@ -60,7 +60,7 @@ def retry_url(url, retry_on_404=True): sys.stderr.write('Caught exception reading instance data, giving up\n') return '' -def get_instance_metadata(version='latest'): +def get_instance_metadata(version='latest',url='http://169.254.169.254'): """ Returns the instance metadata as a nested Python dictionary. Simple values (e.g. local_hostname, hostname, etc.) will be @@ -68,11 +68,11 @@ def get_instance_metadata(version='latest'): be stored in the dict as a list of string values. More complex fields such as public-keys and will be stored as nested dicts. """ - url = 'http://169.254.169.254/%s/meta-data/' % version + url = '%s/%s/meta-data/' % (url,version) return _get_instance_metadata(url) -def get_instance_userdata(version='latest', sep=None): - url = 'http://169.254.169.254/%s/user-data' % version +def get_instance_userdata(version='latest', sep=None,url='http://169.254.169.254'): + url = '%s/%s/user-data' % (url,version) user_data = retry_url(url, retry_on_404=False) if user_data: if sep: |