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/transforms/rightscale_userdata.py | |
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/transforms/rightscale_userdata.py')
-rw-r--r-- | cloudinit/transforms/rightscale_userdata.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cloudinit/transforms/rightscale_userdata.py b/cloudinit/transforms/rightscale_userdata.py index 40d76c89..8dfd845f 100644 --- a/cloudinit/transforms/rightscale_userdata.py +++ b/cloudinit/transforms/rightscale_userdata.py @@ -79,10 +79,10 @@ def handle(name, _cfg, cloud, log, _args): for (i, url) in enumerate(urls): fname = os.path.join(scripts_d, "rightscale-%02i" % (i)) try: - (content, st) = uhelp.readurl(url) + resp = uhelp.readurl(url) # Ensure its a valid http response (and something gotten) - if uhelp.ok_http_code(st) and content: - util.write_file(fname, content, mode=0700) + if resp.ok() and resp.contents: + util.write_file(fname, str(resp), mode=0700) wrote_fns.append(fname) except Exception as e: captured_excps.append(e) |