From b6f158b8a55f37d9d2854ff0e566298b85cc0c89 Mon Sep 17 00:00:00 2001 From: harlowja Date: Sun, 17 Jun 2012 18:23:24 -0700 Subject: 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. --- cloudinit/transforms/rightscale_userdata.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cloudinit/transforms/rightscale_userdata.py') 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) -- cgit v1.2.3