summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/resource.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix for #3556 Plussignment value meldingMarkus Roberts2010-02-171-4/+10
| | | | | | | | | | | | | | The plussignment operator was constructing the new parameter value by modifying the param object's value in place (so as to preserve the file and line information for debugging). However, when multiple resources are overridden by the same plussignment this would result in all of the resources sharing the same value (the union of all the prior values and the new value), which is wrong. Instead, we need to give each resource its own copy of the value (e.g., a copy of the param object), which this patch implements. Signed-off-by: Markus Roberts <Markus@reality.com>
* Adding environment support to parser resourcesLuke Kanies2010-02-171-0/+2
| | | | | | We just use the scope's environment. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Converging the Resource classes furtherLuke Kanies2010-02-171-46/+18
| | | | | | | | | | | I was using 'params' and 'parameters', so I fixed that and extracted the differences in how they handle parameters into a stubbable method. This allowed me to almost entirely remove the subclass's 'initialize' method. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Adding strictness checking to resourcesLuke Kanies2010-02-171-3/+7
| | | | | | | This is used for AST resources (and fixed the last of the tests I broke in spec/). Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Fixing most of the broken tests in test/Luke Kanies2010-02-171-1/+3
| | | | | | | | This involves a bit of refactoring in the rest of the code to make it all work, but most of the changes are fixing or removing old tests. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Removing Resource::Reference classesLuke Kanies2010-02-171-96/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is hopefully less messy than it first appears, but it's certainly cross-cutting. The reason for all of this is that we previously only looked up builtin resource types from outside the parser, but now that the defined resource types are available globally via environments, we can push that lookup code to Resource. Once we do that, however, we have to have environment and namespace information in every resource. Here I remove the Resource::Reference classes (except the AST class), and use Resource instances instead. I did this because the shared code between the two classes got incredibly complicated, such that they should have had a hierarchical relationship disallowed by their constants. This complexity convinced me just to get rid of References entirely. I also make Puppet::Parser::Resource a subclass of Puppet::Resource. There are still broken tests in test/, but this was a big enough commit I wanted to get it in. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Adding parameter validation to Puppet::ResourceLuke Kanies2010-02-171-1/+1
| | | | | | | | | | | | | This will allow us to remove all of the parameter validation from the other Resource classes. This is possible because resource types defined in the language are visible outside of the parser, via the environment. This will enable lots of code removal and simplication. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Adding []/[]= support to Parser::ResourceLuke Kanies2010-02-171-0/+4
| | | | Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Bug #2534 Raise error if property appears twiceJesse Wolfe2009-10-271-0/+6
| | | | | | | This patch changes Puppet::Parser::Resource to check if it has been passed two Puppet::Parser::Resource::Param objects with the same name. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Fixing #2632 - 'require' works for 0.25 clientsLuke Kanies2009-09-221-5/+5
| | | | | | | | I couldn't find a way to make it compatible with earlier clients, so the docs specify that it doesn't work with them, and it helpfully fails. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing relationship metaparam backward compatibilityLuke Kanies2009-09-221-6/+25
| | | | | | | | | | We broke some cases of metaparam compatibility in 0.25. Most of it was pretty esoteric, but one thing that wasn't working was relationship metaparams specified on defined resources. This adds a compatibility method for older clients. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fix #2507 - Exported resources were not correctly collected.Brice Figureau2009-08-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | #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>
* Make sure overriding a tag also produces a tagBrice Figureau2009-06-111-3/+6
| | | | | | | This is so that overriding the "tag" metaparameter ends-up in the resource tags on the server. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Make sure resources are tagged with the user tag on the serverBrice Figureau2009-06-061-0/+1
| | | | | | | | It appears that resources were not tagged with user tag on the server, which prevents those tags to be persisted as tag in the storeconfigs. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Removed extra whitespace from end of linesIan Taylor2009-06-061-2/+2
|
* Fixing #2230 - exported resources work againLuke Kanies2009-06-031-0/+1
| | | | | | | | This somehow got lost in the conversion from Parser resources to Puppet resources. We now copy over the 'exported' value. Signed-off-by: Luke Kanies <luke@madstop.com>
* Removing unnecessary parser variables when yaml-dumpingLuke Kanies2009-04-221-0/+2
| | | | | | | | | Also working around a YAML bug in Ruby. And fixing tests that were broken in a previous commit in this rebase but not caught earlier. Signed-off-by: Luke Kanies <luke@madstop.com>
* Refactoring the Rails integrationLuke Kanies2009-04-221-74/+6
| | | | | | | | This moves all code from the Parser class into the ActiveRecord classes, and gets rid of 'ar_hash_merge'. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing #1885 - Relationships metaparams do not cascadeLuke Kanies2009-04-221-6/+2
| | | | | | | | | | | | | | | Because we now pass catalogs around, rather than a tree of resources, we no longer lose the metaparam information in definitions and classes. Thus, we no longer need to pass them down to contained resources. Ideally we'd remove cascading of all metaparams (which is ticket #1903) but 'schedule' and 'noop' are inherently recursive but not in a way that the graph support can currently easily solve, so that's going to have to wait for a later release. Signed-off-by: Luke Kanies <luke@madstop.com>
* Merge branch '0.24.x'Luke Kanies2009-04-021-1/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bin/ralsh lib/puppet/executables/client/certhandler.rb lib/puppet/parser/functions/versioncmp.rb lib/puppet/parser/resource/reference.rb lib/puppet/provider/augeas/augeas.rb lib/puppet/provider/nameservice/directoryservice.rb lib/puppet/provider/ssh_authorized_key/parsed.rb lib/puppet/type.rb lib/puppet/type/file/checksum.rb spec/integration/defaults.rb spec/integration/transaction/report.rb spec/unit/executables/client/certhandler.rb spec/unit/indirector/ssl_rsa/file.rb spec/unit/node/catalog.rb spec/unit/provider/augeas/augeas.rb spec/unit/rails.rb spec/unit/type/ssh_authorized_key.rb spec/unit/type/tidy.rb test/executables/filebucket.rb test/executables/puppetbin.rb
| * Using the FileCollection where appropriate.Luke Kanies2009-02-281-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit just replaces the :file and :line accessors with the use of the new FileCollection Lookup module. This should mean that we've normalized all file names in a given process, which *might* have drastic RAM improvements. For initial simplicity, I've gone with a single global collection of file names, but it's built so it's easy to use individual file collections instead. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Change the way the tags and params are handled in railsBrice Figureau2009-02-061-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | The rationale behind this patch is that it takes a lots of time to let rails unserialize the ParamValue and ResourceTag object on each compilation, just to throw them away the second after. The idea is to fetch directly (and batched host per host) the parameters and tags from the database and then returns them as hash. This allows the no-modification case to takes at least 2 times less than before. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Fix #2107 - flatten resource references arrays properlyBrice Figureau2009-03-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resource parameters of the form [Res[a], Res[a,b]] ends being evaluated as [Res[a], [ Res[a], Res[b] ] This last form was not flattened when transfomed into RAL type, which in turn prevented the sub array to be converted in regular resource references. Thus the type was choking when encountering those native parser references instead of usual resource reference. The fix consists in flattening array of references before transformation to trans objects for RAL. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Change the way the tags and params are handled in railsBrice Figureau2009-02-061-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | The rationale behind this patch is that it takes a lots of time to let rails unserialize the ParamValue and ResourceTag object on each compilation, just to throw them away the second after. The idea is to fetch directly (and batched host per host) the parameters and tags from the database and then returns them as hash. This allows the no-modification case to takes at least 2 times less than before. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Fixing #1913 - 'undef' resource values do not get copied to the dbLuke Kanies2009-02-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | There are unfortunately no tests for this patch; the Rails code is disappointingly low on tests as it is, and it would have been essentially an herculian effort add all of the necessary tests just to make sure this worked. I've verified it works in practice, which should be sufficient for now. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Fixing #1914 - 'undef' relationship metaparameters do not stackLuke Kanies2009-02-061-0/+1
| | | | | | | | | | | | | | | | This allows you to specify that a metaparameter is undef inside a definition and keep any parameters from being inherited from the parent. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Renaming the "Catalog#to_type" method to "Catalog#to_ral"Luke Kanies2008-12-181-2/+2
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* | Using Puppet::Resource to convert parser resources to RAL resourcesLuke Kanies2008-12-181-1/+1
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* | Adding resource convertion to the parser resourcesLuke Kanies2008-12-181-44/+32
|/ | | | | | | Also uses Puppet::Resource's method for creating transportable resources. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixed #1045 - Multiple metaparams all get added to resources.Luke Kanies2008-09-241-1/+1
| | | | | | | The problem was that I was using a 'return' in a loop where I should have been using a 'next'. Signed-off-by: Luke Kanies <luke@madstop.com>
* Modified the 'master' handler to use the Catalog class toLuke Kanies2008-04-111-0/+6
| | | | | | | | | | compile node configurations, rather than using the Configuration handler, which was never used directly. I removed the Configuration handler as a result. Modified the 'master' handler (responsible for sending configurations to clients) to always return Time.now as its compile date, so configurations will always get recompiled.
* Always duplicating resource defaults in the parser, so thatLuke Kanies2008-03-061-20/+17
| | | | | | stacked metaparameter values do not result in all resources that receive a given default also getting those stacked values.
* Fixing the fact that resources that model defined resourcesLuke Kanies2008-02-291-0/+7
| | | | | were getting finished multiple times, which meant they got multiple copies of metaparams.
* Fixing #1084 -- the node catalog asks the individualLuke Kanies2008-02-251-0/+9
| | | | | | resources whether they're isomorphic, and they in turn ask the resource types (or default to true for defined resource types).
* Converting the Compile class to use a Node::Catalog instanceLuke Kanies2008-02-111-1/+0
| | | | | as its resource container, instead of having its own behaviour around resource uniqueness.
* Moving all of the tests for Puppet::Parser::Compile toLuke Kanies2008-02-111-14/+0
| | | | | | rspec, so I can refactor the class to more heavily rely on a Node::Catalog instead of doing its own resource container management.
* More AST refactoring -- each of the code wrapping classesLuke Kanies2008-02-081-1/+1
| | | | | | | | | | | just returns a resource from its evaluate() method, and all of the work is done in the evaluate_code method. This makes the code cleaner, because it means 1) evaluate() has the same prototype as all of the other AST classes, 2) evaluate() is no longer called indirectly through the Parser Resource class, and 3) the classes themselves are responsible for creating the resources, rather than it being done in the Compile class.
* Refactoring the AST classes just a bit. I realized thatLuke Kanies2008-02-081-1/+1
| | | | | | all of the evaluate() methods only ever accepted a scope, and sometimes one other option, so I switched them all to use named arguments instead of a hash.
* Store a resource before adding relations to it otherwise activerecord willBart Vanbrabant2008-02-031-0/+2
| | | | complain. This fixes #933
* Fixing #976 -- both the full name of qualified classes andLuke Kanies2008-01-191-25/+10
| | | | | | the class parts are now added as tags. I've also created a Tagging module that we should push throughout the rest of the system that uses tags.
* Theoretically, this patch is to fix #917 (which it does), butLuke Kanies2007-11-281-5/+5
| | | | | | | | | | | | | | | | | | | there were enough problems fixing it that I decided something more drastic needed to be done. This uses the new Puppet::ResourceReference class to canonize what a resource reference looks like and how to retrieve resources via their references. Specifically, it guarantees that resource types are always capitalized, even when they include '::' in them. While many files are modified in this commit, the majority of changes are quite small, and most of the changes are fixing the tests to use capitalized types. As we look at consolidating some of our resource types, we could consolidate the ResourceReference stuff at the same time, but at least the Puppet::Parser::ResourceReference class subclasses the main Puppet::ResourceReference class.
* Fixing a failing test from my fix for #446 -- I had changedLuke Kanies2007-11-191-6/+5
| | | | | | the behaviour of Resource#override_parameter unintentionally. I've corrected the comments so it's clear why the original behaviour was there.
* Fixing #446. I ended up largely not using porridge's patch,Luke Kanies2007-11-191-21/+34
| | | | | | but only because the code (and my coding style, to some extent) has changed so much in the last few months. Also, added specs.
* Successfully modified all tests and code so that all language tests pass ↵Luke Kanies2007-09-041-9/+25
| | | | again. This is the majority of the work necessary to make the separate "configuration" object work.
* We now have a real configuration object, as a subclass of GRATR::Digraph, ↵Luke Kanies2007-09-041-4/+18
| | | | that has a resource graph including resources for the container objects like classes and nodes. It is apparently functional, but I have not gone through all of the other tests to fix them yet. That is next.
* Doing a small amount of refactoring, toward being able to use Parser ↵Luke Kanies2007-09-031-8/+10
| | | | resources to evaluate classes and nodes, not just definitions. This will hopefully simplify some of the parsing work, and it will enable the use of a Configuration object that more completely models a configuration.
* Renaming the "configuration" object to "compile", because it is only a ↵Luke Kanies2007-08-251-2/+2
| | | | transitional object and I want the real "configuration" object to be the thing that I pass from the server to the client; it will be a subclass of GRATR::Digraph.
* A round of bugfixing. Many more tests now pass -- I think we are largely ↵Luke Kanies2007-08-201-0/+2
| | | | down to tests that (yay!) fail in trunk.
* All language tests now pass. I expect there are other failures elsewhere, ↵Luke Kanies2007-08-201-2/+1
| | | | but I want to commit this before delving into them. My method for fixing the tests was to do as little as possible, keeping the tests as bad or as good as they were before I started. Mostly this was about changing references to the interpreter into references to the parser (since that is where the new* methods are now for ast containers) and then dealing with the new config object and its relationship to scopes.
* The first pass where at least all of the snippet tests pass. I have ↵Luke Kanies2007-08-201-155/+164
| | | | unfortunately had to stop being so assiduous in my rewriting of tests, but I am in too much of a time crunch to do this "right". The basic structure is definitely in place, though, and from here it is a question of making the rest of the tests work and hopefully writing some sufficient new tests, rather than making the code itself work.