summaryrefslogtreecommitdiffstats
path: root/lib/puppet/node/facts.rb
Commit message (Collapse)AuthorAgeFilesLines
* Making Fact json handling more resilientLuke Kanies2011-07-151-6/+9
| | | | | | | | | | | We were failing if any values were nil, and values were often nil, at least in testing. We now only include non-nil values, and we handle nil values just fine. Signed-off-by: Luke Kanies <luke@puppetlabs.com> Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* Revert "Fixing Facts pson methods more resilient"Max Martin2011-04-211-12/+8
| | | | | | | | | | | | | This reverts commit 07a7a68a25eb9b21189751c27f90f972224ea533. The JSON patch series has caused problems with the inventory service, and further discussion is needed to decide how to serialize objects to PSON with regards to future compatibility. Conflicts: spec/unit/node/facts_spec.rb Paired-with:Matt Robinson <matt@puppetlabs.com>
* Fixing Facts pson methods more resilientLuke Kanies2011-04-141-8/+12
| | | | | | | | | | | They were currently failing if any values were nil, which happened a lot. We also prefer not to include nil values, since it muddies the json unnecessarily. Reviewed-by: Daniel Pittman <daniel@puppetlabs.com> Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Merge branch '2.6.next' into nextMatt Robinson2011-03-071-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a particularly nasty merge, so rather than hold up merges into next any longer, I'm going to push this merge with a few outstanding problems. The tests that were failing in the following areas have been marked pending, and will be addressed separately, immediately following this push. TODO: Verify that brice's rdoc change is still valid: tests to show that line numbers from class, define and node get into the ast Fix mount parsed_spec spec/unit/provider/mount/parsed_spec.rb * 2.6.next: (85 commits) (#5148) Fix failing spec due to timezone (#5148) Add support for PSON to facts (#6338) Remove inventory indirection, and move to facts indirection (#6445) Fix inline docs: puppet agent does not accept --mkusers Update CHANGELOG and version for 2.6.6rc1 (#6541) Fix content with checksum truncation bug (#6418) Recursive files shouldn't be audited (#6541) maint: whitespace cleanup on the file integration spec (#6541) Fix content with checksum truncation bug (#5466) Write specs for output of puppet resource (#5466) Monkey patch Symbol so that you can sort them (#5466) Fixed puppet resource bug with trailing , Update CHANGELOG for 2.6.5 (#4922) Don't truncate remotely-sourced files on 404 (#6338) Remove unused version control tags Maint: Align tabs in a code block in the Augeas type. (#6509) Inline docs: Fix erroneous code block in directoryservice provider for computer type Maint: Rewrite comments about symlinks to reflect best practice. (#6509) Inline docs: Fix broken lists in Launchd provider. (#6509) Inline docs: Fix broken code blocks in zpool type ... Manually Resolved Conflicts: lib/puppet/application/inspect.rb lib/puppet/defaults.rb lib/puppet/file_bucket/dipper.rb lib/puppet/network/http/handler.rb lib/puppet/node/facts.rb lib/puppet/parser/parser.rb lib/puppet/parser/parser_support.rb lib/puppet/util/command_line/puppet lib/puppet/util/command_line/puppetd lib/puppet/util/command_line/puppetmasterd lib/puppet/util/monkey_patches.rb lib/puppet/util/rdoc/parser.rb spec/unit/application/agent_spec.rb spec/unit/file_bucket/file_spec.rb spec/unit/indirector/file_bucket_file/file_spec.rb spec/unit/network/http/handler_spec.rb spec/unit/parser/parser_spec.rb spec/unit/provider/mount/parsed_spec.rb
| * (#5148) Add support for PSON to factsNick Lewis2011-03-041-0/+21
| | | | | | | | | | | | | | Previously, facts could be fetched via the REST API in PSON, but came back as the to_s representation of a Ruby object, rather than as proper PSON data. This patch adds to_pson and from_pson to facts, so they can be properly used with PSON.
| * Maint: backport timestamp accessor for facts from 2.7 branchPaul Berry2011-02-171-0/+8
| | | | | | | | Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
* | Maint: Add a default value for key in Facts::NodeExpirer#savePaul Berry2010-11-301-1/+1
| | | | | | | | | | Changed to match the signature of the method being overridden. This will allow code to call Facts.indirection.save() without a key.
* | Maint: Swap the order of arguments to Indirection#savePaul Berry2010-11-301-1/+1
| | | | | | | | The first argument was often nil, and the second was mandatory.
* | Maint: Refactor code to use <class>.indirection.<method>Paul Berry2010-11-291-1/+1
| | | | | | | | | | | | Replaced uses of the find, search, destroy, and expire methods on model classes with direct calls to the indirection objects. Also removed the old methods that delegated to the indirection object.
* | Fix #5164 Change Facts timestamp when they are received by the masterJesse Wolfe2010-11-011-5/+13
| | | | | | | | | | | | | | | | | | This patch causes the puppet master to re-timestamp facts when they are received by the catalog compiler terminus. This makes the timestamps more trustworthy, as it means that they are all based upon the same clock's time. Paired-With: Paul Berry <paul@puppetlabs.com>
* | (#5148) Add support for PSON to factsNick Lewis2010-10-281-0/+21
|/ | | | | | | Previously, facts could be fetched via the REST API in PSON, but came back as the to_s representation of a Ruby object, rather than as proper PSON data. This patch adds to_pson and from_pson to facts, so they can be properly used with PSON.
* Code smell: Two space indentationMarkus Roberts2010-07-091-47/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaced 106806 occurances of ^( +)(.*$) with The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people who learned ruby in the 1900s) uses two-space indentation. 3 Examples: The code: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") becomes: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") The code: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object becomes: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object The code: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end becomes: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end
* [#4055] Add CouchDB terminus for factsRein Henrichs2010-02-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Implements an abstract CouchDB terminus and a concrete CouchDB terminus used to store node facts. Node facts are stored in a "node" document as the "facts" attribute. This node document may also be used by other couchdb termini that store node-related information. It is recommended to use a separate document (or documents) to store large data structures like catalogs, linking them to their related node document using embedded ids. This implementation depends on the "couchrest" gem. * Add Puppet.features.couchdb? * Add Puppet[:couchdb_url] setting * Add Puppet::Node::Facts#== for testing * Add PuppetSpec::FIXTURE_DIR for easy access to fixture files * Add CouchDB Terminus * Add Facts::CouchDB terminus * Stores facts inside a "node" document * Use key (hostname) as _id for node document * #find returns nil if document cannot be found * #save finds and updates existing document OR creates new doc [1] * Store facts in "facts" attribute of node document
* [#3921] Fix typo "fact_terminus" -> "facts_terminus"Rein Henrichs2010-02-171-1/+1
| | | | Doh.
* [#3921] Add facts_terminus setting to Puppet settingsRein Henrichs2010-02-171-2/+1
| | | | * defaults to "facter"
* Fixed #3912 - Added client certificate name as an internal fact called ↵James Turnbull2010-02-171-0/+1
| | | | "clientcert"
* REST: hide Request objectJesse Wolfe2010-02-171-1/+1
| | | | | | This change to the REST branch restores some sanity by explicitly allowing a destination URL for indirector save() calls, removing a hack that I was using to accomplish this.
* Refactoring how the Facter integration worksLuke Kanies2009-02-061-0/+21
| | | | | | | | I moved all of the extra Fact modifications into the Facts class, and then moved the calls of those new methods into the Facter terminus. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing the expire method (it wasn't using a requestLuke Kanies2008-04-101-1/+9
| | | | | | internally), and fixing the Facts class so it auto-expires any associated cached nodes when facts are saved.
* Reorganizing the file structure for indirection terminus types.Luke Kanies2007-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Previously, for example, the configuration terminus that was a subclass of 'code' would have been stored at lib/puppet/indirector/code/configuration and would have had to have been named 'configuration'. Now, the subclass can be named however the author prefers, and it must be stored at lib/puppet/indirector/configuration/<name>.rb, where <name> is the name you've chosen for the terminus type. The name only matters insomuch as it is used to load the file from disk and find the appropriate class when asked. The additional restriction is that the class constant for the terminus type must have its name as the last word, and the indirection must be the second to last word. Thus, in our example, we can choose any class constant that ends with Configuration::Code; given that there's only one Configuration class at this point, it makes the most sense to define the class as Puppet::Node::Configuration::Code. This is somewhat awkward, because of the class's location on disk, but the only other real option is to autogenerate a Puppet::Indirector::Configuration class constant, which is, I think, uglier.
* This commit is focused on getting the 'puppet' executableLuke Kanies2007-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | to work. As a result, it involves a lot of integration-level testing, and a lot of small design changes to make the code actually work. In particular, indirections can now have default termini, so that configurations and facts default to their code terminus Also, I've removed the ability to manually control whether ast nodes are used. I might need to add it back in later, but if so it will be in the form of a global setting, rather than the previous system of passing it through 10 different classes. Instead, the parser detects whether there are AST nodes defined and requires them if so or ignores them if not. About 75 tests are still failing in the main set of tests, but it's going to be a long slog to get them working -- there are significant design issues around them, as most of the failures are a result of tests trying to emulate both the client and server sides of a connection, which normally would have different fact termini but in this case must have the same terminus just because they're in the same process and are global. The next step, then, is to figure that process out, thus finding a way to make this all work.
* The indirector specs now all pass. I think I needLuke Kanies2007-09-211-1/+1
| | | | to add a few more specs, though.
* Another intermediate commit. The node and fact classes are now functional ↵Luke Kanies2007-09-121-11/+11
| | | | and are used instead of the network handlers, which have been removed. There are some failing tests as a result, but I want to get this code committed before I massage the rest of the system to make it work again.
* Doing an intermediate commit so rick can look at the work I have done so far.Luke Kanies2007-09-111-0/+36