From b334a1035b645d9e727bdeb03e1fe3729bfc4e1a Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Tue, 19 Jun 2012 18:43:18 -0700 Subject: More path joinings found + update in logging of when we translate a path --- cloudinit/helpers.py | 2 +- cloudinit/transforms/apt_update_upgrade.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cloudinit/helpers.py b/cloudinit/helpers.py index 9f55a984..09686340 100644 --- a/cloudinit/helpers.py +++ b/cloudinit/helpers.py @@ -253,7 +253,7 @@ class Paths(object): # will confuse os.path.join joined = joined.lstrip("/") joined = os.path.join(root, joined) - LOG.debug("Translated %s to adjusted path %s (%s)", + LOG.debug("Translated %s to adjusted path %s (read-only=%s)", pre_joined, joined, read_only) return joined diff --git a/cloudinit/transforms/apt_update_upgrade.py b/cloudinit/transforms/apt_update_upgrade.py index 29bbc1ae..f5b4b58f 100644 --- a/cloudinit/transforms/apt_update_upgrade.py +++ b/cloudinit/transforms/apt_update_upgrade.py @@ -124,6 +124,7 @@ def rename_apt_lists(omirror, new_mirror, lists_d="/var/lib/apt/lists"): return olen = len(oprefix) for filename in glob.glob("%s_*" % oprefix): + # TODO use the cloud.paths.join... util.rename(filename, "%s%s" % (nprefix, filename[olen:])) @@ -136,7 +137,8 @@ def generate_sources_list(codename, mirror, cloud, log): template_fn = cloud.get_template_filename('sources.list') if template_fn: params = {'mirror': mirror, 'codename': codename} - templater.render_to_file(template_fn, '/etc/apt/sources.list', params) + out_fn = cloud.paths.join(False, '/etc/apt/sources.list') + templater.render_to_file(template_fn, out_fn, params) else: log.warn("No template found, not rendering /etc/apt/sources.list") -- cgit v1.2.3