summaryrefslogtreecommitdiffstats
path: root/lib/puppet/resource
Commit message (Collapse)AuthorAgeFilesLines
* Fixing #1054 - transaction reports are always sentLuke Kanies2010-01-181-3/+1
| | | | | | | | | | | | | This refactors how reports, catalogs, configurers, and transactions are all related - the Configurer class manages the report, both creating and sending it, so the transaction is now just responsible for adding data to it. I'm still a bit uncomfortable of the coupling between transactions, the report, and configurer, but it's better than it was. This also fixes #2944 and #2973. Signed-off-by: Luke Kanies <luke@madstop.com>
* ReFix 2675 ending slash in directory should get stripped offJesse Wolfe2010-01-011-0/+4
| | | | | | | | | There was an intermittent bug in Puppet::Parser::Resource::Reference, during initialization, and object could sometimes have its title set before its type is set. This prevented the title from going through type-specific canonicalization. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Least kludgy patch for #2675Markus Roberts2009-11-142-26/+10
| | | | | | | | | | | | | This makes parameters responsible for the canonicalization of their values and provides a default (passthrough) implementation. It changes munge to pre- canonicalize the value and resource references to builtin types to canonicalize titles (which map to resorce namevars) with the corresponding parameter's classes's canonicalization. It adds a canonicalization routine to file paths that normalizes the behaviour (trailing slashes are ignored) and DRYs up the related code. Signed-off-by: Markus Roberts <Markus@reality.com>
* Ticket #2770 (deserializing Exec[...]s with "\n"s)Markus Roberts2009-11-122-3/+3
| | | | | | | | | | | The resource reference logic wasn't handling resources with "\n"s in their namevars gracefully, and detection of this was complicated by infelicitous exception reporting. Note that this patch will require a merge when combined with the patch for #2657. Signed-off-by: Markus Roberts <Markus@reality.com>
* Ticket #2734 PSON/JSON not serializing classes of a catalogMarkus Roberts2009-10-191-1/+6
| | | | | | | Now it does, there are tests to prove it, and the related tests for tags and version have been strengthend. Signed-off-by: Markus Roberts <Markus@reality.com>
* Bundling of pure ruby json lib as "pson"Markus Roberts2009-10-171-29/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bundeling and renaming the pure ruby json library to addresses a number of cross version serliaization bugs (#2615, et al). This patch adds a subset of the files from the json_pure gem to lib/puppet/external/pson (renamed to avoid conflicts with rails) so that we will always have a known-good erialization format available. The pure ruby json gem as distibuted defers to the compiled version if it is installed. This is problematic in some circumstances so the files that have been brought over have been modified to always and only use the bundled version. It's a large patch, so here's a breakdown of the change categories: The majority of the lines are only marginally interesting: * The json lib itself (in lib/puppet/external/pson) make up the bulk of the lines. * Renaming of json to pson make up the second largest group. Somewhat more interesting are the following, which can be located by searching the diffs for the indicated strings: * Adjusting tests to reflect the changes * Changing the encoding/decoding behavior so that nested structures (e.g. resources) don't serialize as escaped strings. This should make it much easier to process the results with external tools, if needed. Search for "to_pson" and "to_pson_data_hash" * Cleaning up the envelope/metadata * Now provides a document_type (as opposed to a ruby class name) by using a symple registration scheme instead of constant lookup (search for "document_type") * Added an api_version (search for "api_version") * Added a hash for document metadata (search for "metadata") * Removing the yaml monkeypatch and instead disabling yaml serialization on ruby 1.8.1 in favor of pson (search for "yaml") * Cleaning up the json/rails feature interaction (they're now totally independent) (search for "feature")
* Adding version information to the catalog for compatLuke Kanies2009-09-221-0/+3
| | | | | | | We need to be able to do compatibility testing, and this allows us to do so. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fix #2507 - Exported resources were not correctly collected.Brice Figureau2009-08-131-2/+5
| | | | | | | | | | | | | | | | | | | | | | #2507 contains two issues: * a crash when we filters-out an unwanted resource which had edges pointing to it. * resources are losing their virtuality when they are transformed from Puppet::Parser::Resource to Puppet::Resource. This means we weren't able to distinguish anymore between an exported resource collected in the same node as it was exported and an exported resource collected in another node. The net result is that we can't apply exported resources that are collected in the same node because they are filtered out by the catalog filter (see the commits for #2391 for more information). The fix is to keep the virtuality of the resources so that we can differentiate those two types of exported resources. We keep this until the catalog is ready to be sent, where we filter out the virtual resouces only, the other still exported ones needs to be sent to the client. To be real sure, the transaction also skips virtual resources. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #2391 - Exported resources never make to the storeconfigs dbBrice Figureau2009-07-181-1/+13
| | | | | | | | | | | | | | | | | | The issue is that when we convert Puppet::Parser::Resource catalog to a Puppet::Resource catalog before storing it to the database, we don't allow virtual resource to be converted. Unfortunately exported resources are virtual by design, and as such aren't converted, and we lose them, so it isn't possible to store them in the database. Unfortunately, the client will get the exported resources too. The fix is dual-fold: * we make sure exported resource are skipped when the transaction is applied as a last safeguard * we filter-out the catalog through the catalog compiler terminus before the catalog is returned to the client Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Switching Queueing to using JSON instead of YAMLLuke Kanies2009-06-061-1/+6
| | | | | | This provides about a 75x speedup, so it's totally worth it. The downside is that queueing requires json, but only on the server side.
* Adding JSON support to CatalogsLuke Kanies2009-06-061-0/+65
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Removed extra whitespace from end of linesIan Taylor2009-06-062-12/+12
|
* Fixing a bunch of warningsLuke Kanies2009-06-032-3/+3
| | | | | | This commit should have no functional effect. Signed-off-by: Luke Kanies <luke@madstop.com>
* Changing Puppet::Cacher::Expirer#expired? method nameLuke Kanies2009-05-281-1/+1
| | | | | | | | | This method name clashed with Puppet::Indirector::Envelope#expired?, and its name wasn't actually very appropriate. The new method name is 'dependent_data_expired?'. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fix #2218 - Ruby YAML bug prevents reloading catalog in puppetdBrice Figureau2009-05-021-14/+0
| | | | | | | | | | | | | | | | | | | Because of ruby bug: http://rubyforge.org/tracker/?group_id=426&atid=1698&func=detail&aid=8886 and http://redmine.ruby-lang.org/issues/show/1331 YAML dump of hashes using ruby objects as keys is incorrect leading to an error when deserializing the YAML in puppetd. The error is easy to correct by a post-process fix-up of the generated YAML, which transforms: &id004 !ruby/object:Puppet::Relationship ? to the correct: ? &id004 !ruby/object:Puppet::Relationship Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Adding equality to ResourceReferenceLuke Kanies2009-04-221-4/+2
| | | | | | | This is used by the Parser subclass when testing equality with db-backed references. Signed-off-by: Luke Kanies <luke@madstop.com>
* Switching to Indirected ActiveRecordLuke Kanies2009-04-221-0/+1
| | | | | | | | | | | This is mostly a configuration change, with some code getting removed. Also adding an extra require in Format; Puppet::Provider requires Puppet::Provider::Confiner, so the constant lookup is weird. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing #2180 - Catalogs yaml dump the resource table firstLuke Kanies2009-04-211-0/+14
| | | | | | | | This fixes a ruby bug (http://rubyforge.org/tracker/?group_id=426&atid=1698&func=detail&aid=8886) that otherwise results in yaml producing text it can't read back in. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing #2112 - Transactions handle conflicting generated resourcesLuke Kanies2009-04-171-14/+3
| | | | | | | | | | This commit rips out all of the 'implicit resource' crap, replacing it with a simple system that just skips resources that the catalog says are in conflict. Removes a bunch of code, and fixes the bug to boot. Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding another stacktrace for debuggingLuke Kanies2009-04-171-0/+1
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing tests broken during the #1405 fix.Luke Kanies2009-02-061-0/+2
| | | | | | Most of these were small changes, like moved methods. Signed-off-by: Luke Kanies <luke@madstop.com>
* Removing the Catalog's @aliases hash default valueLuke Kanies2009-02-061-3/+6
| | | | | | | | | This was prohibiting the catalog from being dumped. No tests, because I didn't change behaviour and the existing tests provided sufficient coverage. Signed-off-by: Luke Kanies <luke@madstop.com>
* Converting the catalog as neededLuke Kanies2009-02-061-1/+5
| | | | | | | Converting to a Resource catalog for transmission, then converting to a RAL catalog on the client. Signed-off-by: Luke Kanies <luke@madstop.com>
* Moving classfile-writing to the CatalogLuke Kanies2009-02-061-0/+11
| | | | | | | | This work was done by the Agent class before, but it's really related to the catalog, so that's where it is now. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing all of the test/ tests I broke in previous dev.Luke Kanies2008-12-181-3/+8
| | | | | | | | | Most of these are straightforward changes to the tests, but a couple required small refactorings (e.g., References can now be created with Puppet::Type instances, and they know how to extract the type/title from them). Signed-off-by: Luke Kanies <luke@madstop.com>
* Deprecating the Puppet::Type.create.Luke Kanies2008-12-181-1/+1
| | | | | | | This method is no longer necessary; you can use the normal 'new' class method. Signed-off-by: Luke Kanies <luke@madstop.com>
* TransObject is nearly deprecated now.Luke Kanies2008-12-182-6/+8
| | | | | | | | | This is all of the plumbing work, the only real thing left to do is to fix the Settings class so that it uses Puppet::Resource instances instead of TransObject and TransBucket. Signed-off-by: Luke Kanies <luke@madstop.com>
* Simplifying the initialization interface for ReferencesLuke Kanies2008-12-181-5/+10
| | | | | | | | | You previously had to call new(nil, "Foo[bar]") if you just had the resource reference as a string. Now you can call new("Foo[bar]"), but the old behaviour works, too. Signed-off-by: Luke Kanies <luke@madstop.com>
* Renaming the "Catalog#to_type" method to "Catalog#to_ral"Luke Kanies2008-12-181-3/+6
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding equality testing to Puppet::Resource::ReferenceLuke Kanies2008-12-181-0/+6
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Renaming Puppet::Node::Catalog to Puppet::Resource::CatalogLuke Kanies2008-12-181-0/+508
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Renaming Puppet::ResourceReference to Puppet::Resource::ReferenceLuke Kanies2008-12-091-0/+86
Signed-off-by: Luke Kanies <luke@madstop.com>