summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceDigitalOcean.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-02-26 14:10:17 -0500
committerScott Moser <smoser@ubuntu.com>2015-02-26 14:10:17 -0500
commitc9c811b2c3bad00cc1f0a3db6b7173bab3b1a7ad (patch)
tree6f36dc496da710a02562f52d05c676b2c8479377 /cloudinit/sources/DataSourceDigitalOcean.py
parente2fea567772f3d178072607aee617c3792185db0 (diff)
parent0ebca9c158c87b28fb61974e9e36e645cf60494c (diff)
downloadvyos-cloud-init-c9c811b2c3bad00cc1f0a3db6b7173bab3b1a7ad.tar.gz
vyos-cloud-init-c9c811b2c3bad00cc1f0a3db6b7173bab3b1a7ad.zip
readurl, read_file_or_url returns bytes, user must convert as necessary
* explicitly test compressed user-data. * userdata_raw is now bytes * add load_tfile_or_url for loading text file or url * ec2_utils: all meta-data is text, remove non-obvious string translations * DigitalOcean: adjust for ec2_utils * DataSourceGCE, DataSourceMAAS: user-data is binary other fields are text. * openstack.py: read paths without decoding to text. This is ok as paths other than user-data are json, and load_json will handle * load_file still returns text, and that is what most things use. LP: #1424900
Diffstat (limited to 'cloudinit/sources/DataSourceDigitalOcean.py')
-rw-r--r--cloudinit/sources/DataSourceDigitalOcean.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/cloudinit/sources/DataSourceDigitalOcean.py b/cloudinit/sources/DataSourceDigitalOcean.py
index 76ddaa9d..5d47564d 100644
--- a/cloudinit/sources/DataSourceDigitalOcean.py
+++ b/cloudinit/sources/DataSourceDigitalOcean.py
@@ -54,9 +54,13 @@ class DataSourceDigitalOcean(sources.DataSource):
def get_data(self):
caller = functools.partial(util.read_file_or_url,
timeout=self.timeout, retries=self.retries)
- md = ec2_utils.MetadataMaterializer(str(caller(self.metadata_address)),
+
+ def mcaller(url):
+ return caller(url).contents
+
+ md = ec2_utils.MetadataMaterializer(mcaller(self.metadata_address),
base_url=self.metadata_address,
- caller=caller)
+ caller=mcaller)
self.metadata = md.materialize()