summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/resource.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* The new parser configuration object works now,Luke Kanies2007-08-161-1/+4
| | | | | | | | | | | | | | but the rest of the compiling process is hosed (although the parser itself should still be fine). The configuration object is unifying a lot of work that was scattered around either the interpreter or the scopes, and it simplifies the whole system. However, its new simplicity has made the complexity of the rest of the system that much more apparent, and I am resolved to fixing the system rather than hacking it sufficiently to just make it work.
* Fixing error message when a parameter is getting redefinedluke2007-07-141-7/+11
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2693 980ebf18-57e1-0310-9a29-db15c13687c0
* Adding patch by Valentin Vidic to add the "+>" syntax for adding values to ↵luke2007-07-101-0/+5
| | | | | | parameters git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2670 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #689, although I have not added unit tests. The problem was that a ↵luke2007-07-051-3/+3
| | | | | | tag name was being removed, rather than the tag object itself. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2651 980ebf18-57e1-0310-9a29-db15c13687c0
* All rails and language tests now pass again. All of the rails tests should ↵luke2007-06-171-1/+10
| | | | | | now be in the rails/ directory, and I have modified resource translation so that it always converts single-member arrays to singe values, which means the rails collection does not need to worry about it. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2597 980ebf18-57e1-0310-9a29-db15c13687c0
* Significantly optimizing the database queries -- I am getting about 40% ↵luke2007-06-141-1/+1
| | | | | | better times now. See http://www.madstop.com/optimizing_the_activerecord_integration.html. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2585 980ebf18-57e1-0310-9a29-db15c13687c0
* Major rework of the rails feature. Changed the relationship between ballman2007-06-121-42/+74
| | | | | | | | | | | | | | | | host and facts (now many-to-many with fact_name through fact_values). Also changed the relationship between resource and params (similarly many-to-many with param_names through param_values). Added the resource_tags and puppet_tags. The latter has the tag names and the former is the man-to-many link with resources. There is a little clean up left but the schema is in order. Also a test for the tags stuff is required. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2565 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #637 -- defined resources can now correctly be virtual or exportedluke2007-06-111-0/+1
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2562 980ebf18-57e1-0310-9a29-db15c13687c0
* Adding #629 -- an undef keyword now existsluke2007-05-171-1/+4
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2522 980ebf18-57e1-0310-9a29-db15c13687c0
* Removed acts_as_taggable from the rails stuff. I haven't removed the tables ↵ballman2007-05-111-5/+3
| | | | | | from the schema nor the indexes yet. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2505 980ebf18-57e1-0310-9a29-db15c13687c0
* Working a little bit on rails failures, with no real progressluke2007-04-301-3/+3
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2439 980ebf18-57e1-0310-9a29-db15c13687c0
* Adding extra info to the "Parameter already set" error, as requested in #573luke2007-04-261-2/+12
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2416 980ebf18-57e1-0310-9a29-db15c13687c0