diff options
author | Robert Jennings <robert.jennings@canonical.com> | 2016-04-27 16:33:13 -0500 |
---|---|---|
committer | Robert Jennings <robert.jennings@canonical.com> | 2016-04-27 16:33:13 -0500 |
commit | 7b65c24f389471bbaa9aa38e164c6440b18f22f4 (patch) | |
tree | d4433a24800e508f3c0a88007091a9fca6fd7190 /cloudinit | |
parent | b029dcefe1ed33be8ed80f2e376ca6874dfd64f7 (diff) | |
download | vyos-cloud-init-7b65c24f389471bbaa9aa38e164c6440b18f22f4.tar.gz vyos-cloud-init-7b65c24f389471bbaa9aa38e164c6440b18f22f4.zip |
Ensure instance path is a child of cloud_dir
A cloud has an instance-id metadata value in the form:
/Compute-$TENANT/$CLOUDUSERNAME/$UUID
The leading '/' causes /var/lib/cloud/instance to link to
/Compute-$TENANT/$CLOUDUSERNAME/$UUID rather than
/var/lib/cloud/instances/Compute-$TENANT/$CLOUDUSERNAME/$UUID
This patch strips the leading path separator from the instance-id.
LP: #1575938
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/helpers.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cloudinit/helpers.py b/cloudinit/helpers.py index 0cf982f3..24a3d5b5 100644 --- a/cloudinit/helpers.py +++ b/cloudinit/helpers.py @@ -375,7 +375,7 @@ class Paths(object): def _get_ipath(self, name=None): if not self.datasource: return None - iid = self.datasource.get_instance_id() + iid = self.datasource.get_instance_id().lstrip(os.sep) if iid is None: return None ipath = os.path.join(self.cloud_dir, 'instances', str(iid)) |