81
81
cleaned_contents = '\n'.join(cleaned_lines)
82
82
puppet_config.readfp(StringIO(cleaned_contents),
83
83
filename=PUPPET_CONF_PATH)
84
for (cfg_name, cfg) in puppet_cfg['conf'].iteritems():
84
for (cfg_name, cfg) in puppet_cfg['conf'].items():
85
85
# Cert configuration is a special case
86
86
# Dump the puppet master ca certificate in the correct place
87
87
if cfg_name == 'ca_cert':
88
88
# Puppet ssl sub-directory isn't created yet
89
89
# Create it with the proper permissions and ownership
90
util.ensure_dir(PUPPET_SSL_DIR, 0771)
90
util.ensure_dir(PUPPET_SSL_DIR, 0o771)
91
91
util.chownbyname(PUPPET_SSL_DIR, 'puppet', 'root')
92
92
util.ensure_dir(PUPPET_SSL_CERT_DIR)
93
93
util.chownbyname(PUPPET_SSL_CERT_DIR, 'puppet', 'root')
94
util.write_file(PUPPET_SSL_CERT_PATH, str(cfg))
94
util.write_file(PUPPET_SSL_CERT_PATH, cfg)
95
95
util.chownbyname(PUPPET_SSL_CERT_PATH, 'puppet', 'root')
97
97
# Iterate throug the config items, we'll use ConfigParser.set
98
98
# to overwrite or create new items as needed
99
for (o, v) in cfg.iteritems():
99
for (o, v) in cfg.items():
100
100
if o == 'certname':
101
101
# Expand %f as the fqdn
102
102
# TODO(harlowja) should this use the cloud fqdn??