Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add functionality to set node object, facts, enviornment based on a remote source #14

Closed
logicminds opened this issue Mar 27, 2016 · 3 comments

Comments

@logicminds
Copy link
Contributor

Puppet has a feature (afaik) that can retrieve facts form either a master or puppetdb. This would be awesome to be able to load the facts from a remote system in order to walk through code and hiera lookups.

@logicminds
Copy link
Contributor Author

logicminds commented Apr 5, 2016

This can be done via the following commands

puppet node find 'puppetdev.localdomain' --terminus rest
Puppet::Node::Facts.indirection.find('hostname')
Puppet::Node.indirection.find('hostname')

@logicminds
Copy link
Contributor Author

logicminds commented May 9, 2016

require 'puppet'
    def node_object(hostname)
      begin
        Puppet.initialize_settings
        Puppet[:trusted_node_data] = true
      rescue
        # do nothing otherwise calling init twice raises an error
      end
      Puppet::Node.indirection.find(hostname)
    end
node_object('pe-puppet.localdomain')
#<Puppet::Node:0x007fb6a321adc0
 @classes=[],
 @environment=
  #<Puppet::Node::Environment:0x007fb6a3036f68
   @attr_expirations={:modules=>2016-05-09 11:59:29 -0700},
   @config_version=nil,
   @manifest=:no_manifest,
   @modulepath=[],
   @name=:"*root*",
   @value_cache={:modules=>[]},
   @watching=true>,
 @expiration=2016-05-09 12:29:15 -0700,
 @facts=
  #<Puppet::Node::Facts:0x007fb6a2ba8708
   @expiration=2016-05-09 12:29:15 -0700,
   @name="pe-puppet.localdomain",
   @values=
    {"architecture"=>"x86_64",
     "kernel"=>"Darwin",
     "domain"=>"local",
     "virtual"=>"physical",
     "is_virtual"=>"false",
     "hardwaremodel"=>"x86_64",
     "operatingsystem"=>"Darwin",
     "os"=>"{\"name\"=>\"Darwin\", \"family\"=>\"Darwin\", \"release\"=>{\"major\"=>\"14\", \"minor\"=>\"5\", \"full\"=>\"14.5.0\"}}",
     "kernelrelease"=>"14.5.0",
     "facterversion"=>"2.4.6",
     "fqdn"=>"MacBook-Pro.local",
     "gid"=>"staff",
     "hardwareisa"=>"i386",
     "hostname"=>"MacBook-Pro",

@logicminds logicminds changed the title add functionality to set facts based on a remote source add functionality to set node object, facts, enviornment based on a remote source May 9, 2016
logicminds added a commit that referenced this issue May 10, 2016
  * adds new error handling classes
  * now bubbles error upward after parsing error
logicminds added a commit that referenced this issue May 10, 2016
  * adds new error handling classes
  * now bubbles error upward after parsing error
  * adds ability to show classification
@logicminds
Copy link
Contributor Author

duplicate of #12

logicminds added a commit that referenced this issue Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant