318
function cfg_set_or_update() {
323
[[ -z "$section" ]] && section="DEFAULT"
324
[[ -z $key ]] && juju-log "ERROR: cfg_set_or_update(): value $value missing key" \
326
[[ -z $value ]] && juju-log "ERROR: cfg_set_or_update(): key $key missing value" \
328
[[ ! -e $file ]] && juju-log "ERROR: cfg_set_or_update(): File not found $file" \
333
config = ConfigParser.RawConfigParser()
335
if '$section' != 'DEFAULT' and not config.has_section('$section'):
336
config.add_section('$section')
337
config.set('$section', '$key', '$value')
338
with open('$file', 'wb') as conf_out:
339
config.write(conf_out)
341
juju-log "Updated config $file, $key = $value in section $section."