diff options
author | Scott Moser <smoser@ubuntu.com> | 2012-12-04 10:01:46 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-12-04 10:01:46 -0500 |
commit | 81ea305461777d5e5bec9f92a0b14c544aa6fd1e (patch) | |
tree | dde2cd2ef65f03cf48cdd51638d0332b0a32d4cc /cloudinit/config/cc_ca_certs.py | |
parent | 52a1884822ecb9474e12e6c16b62dbd0728a4a0e (diff) | |
parent | 1e7b96743314f566814848ad05c5bc7271a5de91 (diff) | |
download | vyos-cloud-init-81ea305461777d5e5bec9f92a0b14c544aa6fd1e.tar.gz vyos-cloud-init-81ea305461777d5e5bec9f92a0b14c544aa6fd1e.zip |
merge from trunk
Diffstat (limited to 'cloudinit/config/cc_ca_certs.py')
-rw-r--r-- | cloudinit/config/cc_ca_certs.py | 9 |
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(): |