summaryrefslogtreecommitdiff
path: root/cloudinit/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/helpers.py')
-rw-r--r--cloudinit/helpers.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cloudinit/helpers.py b/cloudinit/helpers.py
index e9fec628..7f00bf1f 100644
--- a/cloudinit/helpers.py
+++ b/cloudinit/helpers.py
@@ -375,10 +375,11 @@ class Paths(object):
def _get_ipath(self, name=None):
if not self.datasource:
return None
- iid = self.datasource.get_instance_id().replace(os.sep, '_')
+ 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)