From 4d9722ba567a6ed2e355a464f67fddcad1717aa2 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 10 Apr 2012 16:22:47 -0400 Subject: cc_landscape.py: if /etc/landscape does not exist, then create it LP: #978329 --- cloudinit/CloudConfig/cc_landscape.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cloudinit/CloudConfig') diff --git a/cloudinit/CloudConfig/cc_landscape.py b/cloudinit/CloudConfig/cc_landscape.py index 596fd67e..a4113cbe 100644 --- a/cloudinit/CloudConfig/cc_landscape.py +++ b/cloudinit/CloudConfig/cc_landscape.py @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import os +import os.path from cloudinit.CloudConfig import per_instance from configobj import ConfigObj @@ -50,6 +52,9 @@ def handle(_name, cfg, _cloud, log, _args): merged = mergeTogether([lsc_builtincfg, lsc_client_cfg_file, ls_cloudcfg]) + if not os.path.isdir(os.path.dirname(lsc_client_cfg_file)): + os.makedirs(os.path.dirname(lsc_client_cfg_file)) + with open(lsc_client_cfg_file, "w") as fp: merged.write(fp) -- cgit v1.2.3