def _parse_dnamasq(filename):
 fileopts = {}
 if (not os.path.isfile(filename)):
  raise CommandExecutionError("Error: No such file '{0}'".format(filename))
 with salt.utils.fopen(filename, 'r') as fp_:
  for line in fp_:
   if (not line.strip()):
    continue
   if line.startswith('#'):
    continue
   if ('=' in line):
    comps = line.split('=')
    if (comps[0] in fileopts):
     if isinstance(fileopts[comps[0]], str):
      temp = fileopts[comps[0]]
      fileopts[comps[0]] = [temp]
     fileopts[comps[0]].append(comps[1].strip())
    else:
     fileopts[comps[0]] = comps[1].strip()
   else:
    if ('unparsed' not in fileopts):
     fileopts['unparsed'] = []
    fileopts['unparsed'].append(line)
 return fileopts

def _parse_dnamasq ( filename ) : fileopts = { } if ( not os . path . isfile ( filename ) ) : raise CommandExecutionError ( "Error: No such file '{0}'" . format ( filename ) ) with salt . utils . fopen ( filename , 'r' ) as fp_ : for line in fp_ : if ( not line . strip ( ) ) : continue if line . startswith ( '#' ) : continue if ( '=' in line ) : comps = line . split ( '=' ) if ( comps [ 0 ] in fileopts ) : if isinstance ( fileopts [ comps [ 0 ] ] , str ) : temp = fileopts [ comps [ 0 ] ] fileopts [ comps [ 0 ] ] = [ temp ] fileopts [ comps [ 0 ] ] . append ( comps [ 1 ] . strip ( ) ) else : fileopts [ comps [ 0 ] ] = comps [ 1 ] . strip ( ) else : if ( 'unparsed' not in fileopts ) : fileopts [ 'unparsed' ] = [ ] fileopts [ 'unparsed' ] . append ( line ) return fileopts
generic function for parsing dnsmasq files including includes .