()
return all_facts
All facts for the current machine.

  Returns:
    A dictionary of all facts, with values as strings.
  Raises:
    GmacpyutilException: command failed to execute.
All facts for the current machine.
All facts for the current machine .
def Facts():
  """All facts for the current machine.

  Returns:
    A dictionary of all facts, with values as strings.
  Raises:
    GmacpyutilException: command failed to execute.
  """
  cmd = ['/usr/bin/puppet', 'config', '--config', '/etc/puppet/puppet.conf',
         'print', 'factpath']
  # pylint: disable=unpacking-non-sequence
  (stdout, stderr, returncode) = RunProcess(cmd)
  if returncode:
    raise GmacpyutilException('Puppetd Error: %s' % stderr)
  factpath = stdout.strip()  # pylint: disable=maybe-no-member
  all_facts = {}
  cmd = ['/usr/bin/facter', '-p']
  env = {'RUBYLIB': factpath}
  (stdout, stderr, returncode) = RunProcess(cmd, env=env)
  # pylint: enable=unpacking-non-sequence
  if returncode:
    raise GmacpyutilException('Facter Error: %s' % stderr)
  for line in stdout.split('\n'):  # pylint: disable=maybe-no-member
    fact_value = [i.strip() for i in line.split('=>')]
    if len(fact_value) != 2:
      continue
    fact = fact_value[0]
    value = str(fact_value[1])
    all_facts[fact] = value
  return all_facts
def Facts ( ) : cmd = [ '/usr/bin/puppet' , 'config' , '--config' , '/etc/puppet/puppet.conf' , 'print' , 'factpath' ] # pylint: disable=unpacking-non-sequence ( stdout , stderr , returncode ) = RunProcess ( cmd ) if returncode : raise GmacpyutilException ( 'Puppetd Error: %s' % stderr ) factpath = stdout . strip ( ) # pylint: disable=maybe-no-member all_facts = { } cmd = [ '/usr/bin/facter' , '-p' ] env = { 'RUBYLIB' : factpath } ( stdout , stderr , returncode ) = RunProcess ( cmd , env = env ) # pylint: enable=unpacking-non-sequence if returncode : raise GmacpyutilException ( 'Facter Error: %s' % stderr ) for line in stdout . split ( '\n' ) : # pylint: disable=maybe-no-member fact_value = [ i . strip ( ) for i in line . split ( '=>' ) ] if len ( fact_value ) != 2 : continue fact = fact_value [ 0 ] value = str ( fact_value [ 1 ] ) all_facts [ fact ] = value return all_facts