def showconfig(name, default=False, dict_return=False):
 portpath = _check_portname(name)
 if (default and _options_file_exists(name)):
  saved_config = showconfig(name, default=False, dict_return=True)
  rmconfig(name)
  if _options_file_exists(name):
   raise CommandExecutionError('Unable to get default configuration')
  default_config = showconfig(name, default=False, dict_return=dict_return)
  _write_options(name, saved_config)
  return default_config
 try:
  result = __salt__['cmd.run_all'](['make', 'showconfig'], cwd=portpath, python_shell=False)
  output = result['stdout'].splitlines()
  if (result['retcode'] != 0):
   error = result['stderr']
  else:
   error = ''
 except TypeError:
  error = result
 if error:
  msg = "Error running 'make showconfig' for {0}: {1}".format(name, error)
  log.error(msg)
  raise SaltInvocationError(msg)
 if (not dict_return):
  return '\n'.join(output)
 if ((not output) or ('configuration options' not in output[0])):
  return {}
 try:
  pkg = output[0].split()[(-1)].rstrip(':')
 except (IndexError, AttributeError, TypeError) as exc:
  log.error('Unable to get pkg-version string: {0}'.format(exc))
  return {}
 ret = {pkg: {}}
 output = output[1:]
 for line in output:
  try:
   (opt, val, desc) = re.match('\\s+([^=]+)=(off|on): (.+)', line).groups()
  except AttributeError:
   continue
  ret[pkg][opt] = val
 if (not ret[pkg]):
  return {}
 return ret

def showconfig ( name , default = False , dict_return = False ) : portpath = _check_portname ( name ) if ( default and _options_file_exists ( name ) ) : saved_config = showconfig ( name , default = False , dict_return = True ) rmconfig ( name ) if _options_file_exists ( name ) : raise CommandExecutionError ( 'Unable to get default configuration' ) default_config = showconfig ( name , default = False , dict_return = dict_return ) _write_options ( name , saved_config ) return default_config try : result = __salt__ [ 'cmd.run_all' ] ( [ 'make' , 'showconfig' ] , cwd = portpath , python_shell = False ) output = result [ 'stdout' ] . splitlines ( ) if ( result [ 'retcode' ] != 0 ) : error = result [ 'stderr' ] else : error = '' except TypeError : error = result if error : msg = "Error running 'make showconfig' for {0}: {1}" . format ( name , error ) log . error ( msg ) raise SaltInvocationError ( msg ) if ( not dict_return ) : return '\n' . join ( output ) if ( ( not output ) or ( 'configuration options' not in output [ 0 ] ) ) : return { } try : pkg = output [ 0 ] . split ( ) [ ( - 1 ) ] . rstrip ( ':' ) except ( IndexError , AttributeError , TypeError ) as exc : log . error ( 'Unable to get pkg-version string: {0}' . format ( exc ) ) return { } ret = { pkg : { } } output = output [ 1 : ] for line in output : try : ( opt , val , desc ) = re . match ( '\\s+([^=]+)=(off|on): (.+)' , line ) . groups ( ) except AttributeError : continue ret [ pkg ] [ opt ] = val if ( not ret [ pkg ] ) : return { } return ret
dump config data .