def write_conf(conf_file, conf):
 if (not isinstance(conf, list)):
  raise SaltInvocationError('Configuration must be passed as a list')
 content = ''
 for line in conf:
  if isinstance(line, (six.text_type, six.string_types)):
   content += line
  elif isinstance(line, dict):
   for key in list(line.keys()):
    out_line = None
    if isinstance(line[key], (six.text_type, six.string_types, six.integer_types, float)):
     out_line = ' = '.join((key, '{0}'.format(line[key])))
    elif isinstance(line[key], dict):
     out_line = ' = '.join((key, line[key]['value']))
     if ('comment' in line[key]):
      out_line = ' # '.join((out_line, line[key]['comment']))
    if out_line:
     content += out_line
     content += '\n'
 with salt.utils.fopen(conf_file, 'w') as fp_:
  fp_.write(content)
 return {}

def write_conf ( conf_file , conf ) : if ( not isinstance ( conf , list ) ) : raise SaltInvocationError ( 'Configuration must be passed as a list' ) content = '' for line in conf : if isinstance ( line , ( six . text_type , six . string_types ) ) : content += line elif isinstance ( line , dict ) : for key in list ( line . keys ( ) ) : out_line = None if isinstance ( line [ key ] , ( six . text_type , six . string_types , six . integer_types , float ) ) : out_line = ' = ' . join ( ( key , '{0}' . format ( line [ key ] ) ) ) elif isinstance ( line [ key ] , dict ) : out_line = ' = ' . join ( ( key , line [ key ] [ 'value' ] ) ) if ( 'comment' in line [ key ] ) : out_line = ' # ' . join ( ( out_line , line [ key ] [ 'comment' ] ) ) if out_line : content += out_line content += '\n' with salt . utils . fopen ( conf_file , 'w' ) as fp_ : fp_ . write ( content ) return { }
write out an lxc configuration file this is normally only used internally .