summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorShraddha Pandhe <shraddha.pandhe@yahoo.com>2013-12-11 15:41:14 -0800
committerShraddha Pandhe <shraddha.pandhe@yahoo.com>2013-12-11 15:41:14 -0800
commit7c6f2de4f7f66874d6c9131c04cb84637955e5ce (patch)
treeb3bdebd2d0c9ba17c2df019d75d7fd46ee633b50 /cloudinit
parentc0d263968d93e44fbaaa98d284690ac93a6ce024 (diff)
downloadvyos-cloud-init-7c6f2de4f7f66874d6c9131c04cb84637955e5ce.tar.gz
vyos-cloud-init-7c6f2de4f7f66874d6c9131c04cb84637955e5ce.zip
essage
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/config/cc_debug.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/cloudinit/config/cc_debug.py b/cloudinit/config/cc_debug.py
index 85dc5c58..a3d99da8 100644
--- a/cloudinit/config/cc_debug.py
+++ b/cloudinit/config/cc_debug.py
@@ -67,10 +67,10 @@ def handle(name, cfg, cloud, log, args):
# Now dump it...
to_print = StringIO()
to_print.write(_make_header("Config"))
- to_print.write(_format_yaml(dump_cfg))
+ to_print.write(util.yaml_dumps(dump_cfg))
to_print.write("\n")
to_print.write(_make_header("MetaData"))
- to_print.write(_format_yaml(cloud.datasource.metadata))
+ to_print.write(util.yaml_dumps(cloud.datasource.metadata))
to_print.write("\n")
to_print.write(_make_header("Misc"))
to_print.write("Datasource: %s\n" % (type_utils.obj_name(cloud.datasource)))
@@ -80,9 +80,11 @@ def handle(name, cfg, cloud, log, args):
to_print.write("Locale: %s\n" % (cloud.get_locale()))
to_print.write("Launch IDX: %s\n" % (cloud.launch_index))
contents = to_print.getvalue()
+ content_to_file = []
for line in contents.splitlines():
line = "ci-info: %s\n" % (line)
- if out_file:
- util.write_file(out_file, line, 0644, "a")
- else:
- util.multi_log(line, console=True, stderr=False)
+ content_to_file.append(line)
+ if out_file:
+ util.write_file(out_file, "".join(content_to_file), 0644, "w")
+ else:
+ util.multi_log("".join(content_to_file), console=True, stderr=False)