diff options
author | harlowja <harlowja@virtualbox.rhel> | 2012-06-17 18:23:24 -0700 |
---|---|---|
committer | harlowja <harlowja@virtualbox.rhel> | 2012-06-17 18:23:24 -0700 |
commit | b6f158b8a55f37d9d2854ff0e566298b85cc0c89 (patch) | |
tree | 706d434f19edf151d51072a32c41f3baa26093cc /cloudinit/sources | |
parent | bc5322d2bc81b2421ae8dfe1bb02fa2fd61fed51 (diff) | |
download | vyos-cloud-init-b6f158b8a55f37d9d2854ff0e566298b85cc0c89.tar.gz vyos-cloud-init-b6f158b8a55f37d9d2854ff0e566298b85cc0c89.zip |
1. Add a url response class that urlreading now returns (instead of a tuple).
a. This allows for more properties to be added as needed in the future, instead of being very restrictive.
2. Fix up all uses of the url reading to now use this new response object.
3. Also fixup user data including, such that if no response actual occurs the url content is not further processed.
Diffstat (limited to 'cloudinit/sources')
-rw-r--r-- | cloudinit/sources/DataSourceMAAS.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cloudinit/sources/DataSourceMAAS.py b/cloudinit/sources/DataSourceMAAS.py index 40ace947..bb8fbac1 100644 --- a/cloudinit/sources/DataSourceMAAS.py +++ b/cloudinit/sources/DataSourceMAAS.py @@ -185,9 +185,12 @@ def read_maas_seed_url(seed_url, header_cb=None, timeout=None, else: headers = {} try: - (resp, sc) = uhelp.readurl(url, headers=headers, timeout=timeout) - if uhelp.ok_http_code(sc): - md[name] = resp + resp = uhelp.readurl(url, headers=headers, timeout=timeout) + if resp.ok(): + md[name] = str(resp) + else: + LOG.warn(("Fetching from %s resulted in" + " an invalid http code %s"), url, resp.code) except urllib2.HTTPError as e: if e.code != 404: raise |