~smoser/ubuntu/quantal/cloud-init/sru

« back to all changes in this revision

Viewing changes to cloudinit/config/cc_ca_certs.py

  • Committer: Scott Moser
  • Date: 2012-12-02 02:59:06 UTC
  • Revision ID: smoser@brickies.net-20121202025906-ihcksoj3i2fgg5za
debian/patches/lp-1077020-fix-ca-certificates-blanklines.patch: fix
adding of empty lines in ca-certificates file (LP: #1077020)

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        cert_file_fullpath = os.path.join(CA_CERT_PATH, CA_CERT_FILENAME)
47
47
        cert_file_fullpath = paths.join(False, cert_file_fullpath)
48
48
        util.write_file(cert_file_fullpath, cert_file_contents, mode=0644)
 
49
 
49
50
        # Append cert filename to CA_CERT_CONFIG file.
50
 
        util.write_file(paths.join(False, CA_CERT_CONFIG),
51
 
                        "\n%s" % CA_CERT_FILENAME, omode="ab")
 
51
        # We have to strip the content because blank lines in the file
 
52
        # causes subsequent entries to be ignored. (LP: #1077020)
 
53
        orig = util.load_file(CA_CERT_CONFIG)
 
54
        cur_cont = '\n'.join([l for l in orig.splitlines()
 
55
                              if l != CA_CERT_FILENAME])
 
56
        out = "%s\n%s\n" % (cur_cont.rstrip(), CA_CERT_FILENAME)
 
57
        util.write_file(CA_CERT_CONFIG, out, omode="wb")
52
58
 
53
59
 
54
60
def remove_default_ca_certs(paths):