Commit 7b65c24f authored by Robert Jennings's avatar Robert Jennings

Ensure instance path is a child of cloud_dir

A cloud has an instance-id metadata value in the form:


The leading '/' causes /var/lib/cloud/instance to link to
/Compute-$TENANT/$CLOUDUSERNAME/$UUID rather than

This patch strips the leading path separator from the instance-id.

LP: #1575938
parent b029dcef
......@@ -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))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment