summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorharlowja <harlowja@virtualbox.rhel>2012-06-20 00:21:56 -0700
committerharlowja <harlowja@virtualbox.rhel>2012-06-20 00:21:56 -0700
commit8136843f3d18358b63119900578134d9673422a0 (patch)
tree2fe443dc5c935cb5be2ee26006dc7cb581388399
parentdc2e7aa9ed143007a963a33dbb8e8efd79cc42ef (diff)
downloadvyos-cloud-init-8136843f3d18358b63119900578134d9673422a0.tar.gz
vyos-cloud-init-8136843f3d18358b63119900578134d9673422a0.zip
Uppercase constants, remove need to use cloud.paths.join since scripts_d should already be modified
-rw-r--r--cloudinit/transforms/rightscale_userdata.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/cloudinit/transforms/rightscale_userdata.py b/cloudinit/transforms/rightscale_userdata.py
index dc06f9ec..8385e281 100644
--- a/cloudinit/transforms/rightscale_userdata.py
+++ b/cloudinit/transforms/rightscale_userdata.py
@@ -45,8 +45,8 @@ from urlparse import parse_qs
frequency = PER_INSTANCE
-my_name = "cc_rightscale_userdata"
-my_hookname = 'CLOUD_INIT_REMOTE_HOOK'
+MY_NAME = "cc_rightscale_userdata"
+MY_HOOKNAME = 'CLOUD_INIT_REMOTE_HOOK'
def handle(name, _cfg, cloud, log, _args):
@@ -58,10 +58,10 @@ def handle(name, _cfg, cloud, log, _args):
try:
mdict = parse_qs(ud)
- if not mdict or not my_hookname in mdict:
+ if not mdict or not MY_HOOKNAME in mdict:
log.debug(("Skipping transform %s, "
"did not find %s in parsed"
- " raw userdata"), name, my_hookname)
+ " raw userdata"), name, MY_HOOKNAME)
return
except:
util.logexc(log, ("Failed to parse query string %s"
@@ -75,10 +75,9 @@ def handle(name, _cfg, cloud, log, _args):
# TODO: maybe this should just be a new user data handler??
# Instead of a late transform that acts like a user data handler?
scripts_d = cloud.get_ipath_cur('scripts')
- urls = mdict[my_hookname]
+ urls = mdict[MY_HOOKNAME]
for (i, url) in enumerate(urls):
fname = os.path.join(scripts_d, "rightscale-%02i" % (i))
- fname = cloud.paths.join(False, fname)
try:
resp = uhelp.readurl(url)
# Ensure its a valid http response (and something gotten)
@@ -88,7 +87,7 @@ def handle(name, _cfg, cloud, log, _args):
except Exception as e:
captured_excps.append(e)
util.logexc(log, "%s failed to read %s and write %s",
- my_name, url, fname)
+ MY_NAME, url, fname)
if wrote_fns:
log.debug("Wrote out rightscale userdata to %s files", len(wrote_fns))