def modify_conf(cfgfile, service_name, outfn):
if not cfgfile or not outfn:<EOL><INDENT>print('<STR_LIT>')<EOL>sys.exit(<NUM_LIT:0>)<EOL><DEDENT>options = service_options[service_name]<EOL>with open(cfgfile, '<STR_LIT:r>') as cf:<EOL><INDENT>lines = cf.readlines()<EOL><DEDENT>for opt in options:<EOL><INDENT>op = opt.get('<STR_LIT>')<EOL>res = [line for line in lines if line.startswith(op)]<EOL>if len(res) > <NUM_LIT:1>:<EOL><INDENT>print('<STR_LIT>' % res)<EOL>sys.exit(<NUM_LIT:0>)<EOL><DEDENT>if res:<EOL><INDENT>(op, sep, val) = (res[<NUM_LIT:0>].strip('<STR_LIT:\n>').replace('<STR_LIT:U+0020>', '<STR_LIT>').<EOL>partition('<STR_LIT:=>'))<EOL>new_val = None<EOL>if opt.get('<STR_LIT>'):<EOL><INDENT>if not any(opt.get('<STR_LIT:value>') == value for value in<EOL>val.split('<STR_LIT:U+002C>')):<EOL><INDENT>new_val = '<STR_LIT:U+002C>'.join((val, opt.get('<STR_LIT:value>')))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if val != opt.get('<STR_LIT:value>'):<EOL><INDENT>new_val = opt.get('<STR_LIT:value>')<EOL><DEDENT><DEDENT>if new_val:<EOL><INDENT>opt_idx = lines.index(res[<NUM_LIT:0>])<EOL>lines.pop(opt_idx)<EOL>lines.insert(opt_idx, '<STR_LIT:=>'.join((opt.get('<STR_LIT>'),<EOL>new_val + '<STR_LIT:\n>')))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>sec_idx = lines.index('<STR_LIT:[>' + opt.get('<STR_LIT>') + '<STR_LIT>')<EOL>lines.insert(sec_idx + <NUM_LIT:1>, '<STR_LIT:=>'.join(<EOL>(opt.get('<STR_LIT>'), opt.get('<STR_LIT:value>') + '<STR_LIT:\n>')))<EOL><DEDENT>except ValueError:<EOL><INDENT>print('<STR_LIT>' % opt.get('<STR_LIT>'))<EOL>sys.exit(<NUM_LIT:0>)<EOL><DEDENT><DEDENT><DEDENT>with open(outfn, '<STR_LIT:w>') as fwp:<EOL><INDENT>all_lines = '<STR_LIT>'<EOL>for line in lines:<EOL><INDENT>all_lines += line<EOL><DEDENT>fwp.write(all_lines)<EOL><DEDENT>
Modify config file neutron and keystone to include enabler options.