Skip to content

Instantly share code, notes, and snippets.

@lak
Created July 6, 2009 03:01
Show Gist options
  • Select an option

  • Save lak/141240 to your computer and use it in GitHub Desktop.

Select an option

Save lak/141240 to your computer and use it in GitHub Desktop.
class BaseTesting
STORE = :data_mapper
def initialize
Puppet::Node.terminus_class = STORE
Puppet::Node::Facts.terminus_class = STORE
end
def node_test
node = Puppet::Node.new("foo.madstop.com")
node.environment = "production"
node.ipaddress = "127.0.0.1"
node.save
p node
node = Puppet::Node.find("foo.madstop.com")
p node
node.environment = "development"
node.ipaddress = "127.0.0.5"
node.save
p Puppet::Node.find("foo.madstop.com")
end
def facts_test
p Puppet::Node::Facts.find("foo.madstop.com")
facts = Puppet::Node::Facts.new("foo.madstop.com")
facts.values = {"one" => "two", "horse" => "shoe"}
facts.save
p facts
facts = Puppet::Node::Facts.find("foo.madstop.com")
p facts
facts.values["foo"] = "bar"
facts.values.delete("one")
facts.save
p Puppet::Node::Facts.find("foo.madstop.com")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment