summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2010-08-13 11:42:57 -0400
committerScott Moser <smoser@ubuntu.com>2010-08-13 11:42:57 -0400
commit38422134fb64879cad81beb6cad15e538bdf87a6 (patch)
tree33afa6f3e48231da8f5f05b452f4bd2b021f94d8 /cloudinit
parentaa88711b90478e71924f0be7794765581391577f (diff)
downloadvyos-cloud-init-38422134fb64879cad81beb6cad15e538bdf87a6.tar.gz
vyos-cloud-init-38422134fb64879cad81beb6cad15e538bdf87a6.zip
add support for '%s' in base of seed.
if 'base' input to reed_seeded contains a "%s", then substitute 'user-data' and 'meta-data' at that location rather than at the end. Ie: - base="http://foo.bar/" userdata_url = http://foo.bar/user-data metadata_url = http://foo.bar/meta-data - base="http://foo.bar/%s?user=smoser" userdata_url = http://foo.bar/user-data&user=smoser" metadata_url = http://foo.bar/meta-data&user=smoser"
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/util.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 59eb2b9f..dfe98b7b 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -142,8 +142,12 @@ def read_seeded(base="", ext="", timeout=2):
if base.startswith("/"):
base="file://%s" % base
- ud_url = "%s%s%s" % (base, "user-data", ext)
- md_url = "%s%s%s" % (base, "meta-data", ext)
+ if base.find("%s") >= 0:
+ ud_url = base % ("user-data" + ext)
+ md_url = base % ("meta-data" + ext)
+ else
+ ud_url = "%s%s%s" % (base, "user-data", ext)
+ md_url = "%s%s%s" % (base, "meta-data", ext)
try:
md_resp = urllib2.urlopen(urllib2.Request(md_url), timeout=timeout)