summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_ca_certs.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-03-07 16:27:47 -0500
committerScott Moser <smoser@ubuntu.com>2013-03-07 16:27:47 -0500
commit3199df6e1489da03d51ac8a2a4574c27fd325189 (patch)
tree921700212c063d1b468a8ea2cac4f7df0f3a68d9 /cloudinit/config/cc_ca_certs.py
parent21aec9e44c27b9bf1c96314f0449fd39793d1c73 (diff)
parent8013c284e82349246b2274f5475c138323fd7c55 (diff)
downloadvyos-cloud-init-3199df6e1489da03d51ac8a2a4574c27fd325189.tar.gz
vyos-cloud-init-3199df6e1489da03d51ac8a2a4574c27fd325189.zip
merge from trunk
Diffstat (limited to 'cloudinit/config/cc_ca_certs.py')
-rw-r--r--cloudinit/config/cc_ca_certs.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/cloudinit/config/cc_ca_certs.py b/cloudinit/config/cc_ca_certs.py
index 20f24357..4f2a46a1 100644
--- a/cloudinit/config/cc_ca_certs.py
+++ b/cloudinit/config/cc_ca_certs.py
@@ -45,8 +45,15 @@ def add_ca_certs(certs):
# First ensure they are strings...
cert_file_contents = "\n".join([str(c) for c in certs])
util.write_file(CA_CERT_FULL_PATH, cert_file_contents, mode=0644)
+
# Append cert filename to CA_CERT_CONFIG file.
- util.write_file(CA_CERT_CONFIG, "\n%s" % CA_CERT_FILENAME, omode="ab")
+ # We have to strip the content because blank lines in the file
+ # causes subsequent entries to be ignored. (LP: #1077020)
+ orig = util.load_file(CA_CERT_CONFIG)
+ cur_cont = '\n'.join([l for l in orig.splitlines()
+ if l != CA_CERT_FILENAME])
+ out = "%s\n%s\n" % (cur_cont.rstrip(), CA_CERT_FILENAME)
+ util.write_file(CA_CERT_CONFIG, out, omode="wb")
def remove_default_ca_certs():