diff options
author | Scott Moser <smoser@ubuntu.com> | 2016-04-29 11:23:08 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2016-04-29 11:23:08 -0400 |
commit | 0780b3abfb14e8994f6097c5d1d22a92e91bc2f5 (patch) | |
tree | 08a534e49053403bc77351c5b2096f94e314e538 /cloudinit/helpers.py | |
parent | c92f02037afc6b0434c9498904f7d888e00cd55b (diff) | |
parent | 89fe4242aa3d825ee1b439cc8d184ddf06382086 (diff) | |
download | vyos-cloud-init-0780b3abfb14e8994f6097c5d1d22a92e91bc2f5.tar.gz vyos-cloud-init-0780b3abfb14e8994f6097c5d1d22a92e91bc2f5.zip |
Paths: fix instance path if datasource's id has a '/'.
If the datasource's instance id contained a '/' then the instance_id path
would not be as expected under /var/lib/cloud/instances/instance_id.
LP: #1575938
Diffstat (limited to 'cloudinit/helpers.py')
-rw-r--r-- | cloudinit/helpers.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cloudinit/helpers.py b/cloudinit/helpers.py index 0cf982f3..7f00bf1f 100644 --- a/cloudinit/helpers.py +++ b/cloudinit/helpers.py @@ -378,7 +378,8 @@ class Paths(object): iid = self.datasource.get_instance_id() if iid is None: return None - ipath = os.path.join(self.cloud_dir, 'instances', str(iid)) + path_safe_iid = str(iid).replace(os.sep, '_') + ipath = os.path.join(self.cloud_dir, 'instances', path_safe_iid) add_on = self.lookups.get(name) if add_on: ipath = os.path.join(ipath, add_on) |