summaryrefslogtreecommitdiffstats
path: root/lib/puppet/rails
Commit message (Collapse)AuthorAgeFilesLines
* Removing Resource::Reference classesLuke Kanies2010-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge branch '0.25.x'James Turnbull2010-01-133-33/+22
|\ | | | | | | | | | | Conflicts: lib/puppet/ssl/host.rb spec/spec_helper.rb
| * Fix for temporary file security wholeMarkus Roberts2010-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We create temporary files in /tmp/ with predictable names. These could be used by an attacker to DoS a box by setting a symlink to some other file (say, /etc/shadow) and waiting for us to overwrite it. The minimalistic solution employed by this patch is to wrap all such file writing with a paranoid wrapper that: 1) Check to see if the target exists 2) Issues a warning if it was a symlink 3) Deletes it 4) Waits (0.1 seconds if it was a file, 5 seconds if it was a symlink) 5) Opens the file with EXCL, which will fail if the file has come back. If this succeeds (as it normally will) it has exactly the same semantics as the original code (a must, as we are right at a release boundary). However, under no circumstances will it follow a preexisting symlink (the operating system guarantees this with EXCL) so the danger of an exploit has been converted into the possibility of a failure, with an appropriate warning.
| * Fixing #2964 updated resources cannot be collected until they are exported twiceMarkus Roberts2009-12-231-1/+1
| | | | | | | | | | | | | | This logic had a bug where it would not insert data if it had just been deleted. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
| * Fix for #2863 (calling each on uninitialized tag list)Markus Roberts2009-12-102-31/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a fix for the core issue of #2863, calling each on a nil tag (instead of empty) tag list for a resource with no tags, combined with various cleanup in related code to forestall reintroduction of a similar bug. * Replace the direct @var access with an initializing getter * Rename it from @tags_hash to @tags_list since it's not a hash * Do the same with the otherwise identical params setup. * Eliminate the now-redundant external initialization for params. * Remove the parameters method as it was never used and obviously faulty (calling a non-existent get_params_hash method).
* | Merge branch '0.25.x'Luke Kanies2009-12-211-1/+1
|\| | | | | | | | | | | | | | | Conflicts: lib/puppet/agent.rb lib/puppet/application/puppetd.rb lib/puppet/parser/ast/leaf.rb lib/puppet/util/rdoc/parser.rb
| * Possible workaround for #2824 (MRI GC bug)Markus Roberts2009-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a moderately ugly workaround for the MRI garbage collection bug (see the ticket for details). I explored several other potential solutions (notably, monkey patching the routines that trigger the bug) but none of them were satisfactory. Monkey patching sub, gsub, sub!, gsub!, etc., for example, either changes the scoping of $~, $1, etc. in a way that could potentially subtly change the meaning of programs or (if you are clever) faithfully reproduces the behaviour of MRI--including the memory leak. I decided to go with the standardized and somewhat obnoxious never- used optional argument as it was easy to automatically insert and should be even easier to automatically find and remove if a better fix is developed. It also should be obtrusive enough to escape accidental removal in refactoring.
* | Patch to address feature #2571 to add Oracle support to PuppetAvi Miller2009-10-243-6/+11
|/ | | | | | Adapter requires specifying database, username and password. Signed-off-by: Avi Miller <avi.miller@gmail.com>
* Feature #2378 - Implement "thin_storeconfigs"Brice Figureau2009-07-181-1/+6
| | | | | | | | | | | | | | | Thin storeconfigs is a limited version of storeconfigs that is more performant and still allows the exported/collected resources system wich is the primary use of storeconfigs. It works by storing to the database only the exported resources, tags and host facts. Since usually those exported resources are less than the number of total resources for a node, it is expected to be faster than regular storeconfigs (especially for the first run). Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Removed extra whitespace from end of linesIan Taylor2009-06-0611-26/+26
|
* Always providing a value for 'exported' on Rails resourcesLuke Kanies2009-06-031-2/+11
| | | | | | | | | | | We often didn't set a value, unless it was true, which meant that if it had previously been true but was now false, we didn't fix it. We also were not always saving modified resources, which in some cases resulted in work not getting saved. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing #2187 - Puppet::Resource is expected by Rails supportLuke Kanies2009-04-243-14/+13
| | | | | | | | | | | | | We previously used and expected Puppet::Parser::Resource instances, but 0.25 converts them all to Puppet::Resource instances before they're passed out of the compiler, so the Rails integration had to be changed to expect that. There's still some muddling, because the rails resources only generate parser resources, but that works for now because that's what we expect when collecting resources. Signed-off-by: Luke Kanies <luke@madstop.com>
* Added class_name tags to has_many relationshipssteve mcintosh2009-04-221-3/+3
|
* renaming a methodLuke Kanies2009-04-222-10/+10
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Adjusted parameter name and puppet tag classes to use new cache accumulator ↵Ethan Rowe2009-04-222-18/+7
| | | | | | behavior for storeconfigs. Removed per-class implementatiosn of accumulate_by_name from affected classes.
* Saving rails resources as I create them, which saves about 10%Luke Kanies2009-04-221-0/+2
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding some more fine-grained benchmarks to Rails supportLuke Kanies2009-04-222-22/+26
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding a Rails-specific benchmarking moduleLuke Kanies2009-04-223-39/+107
| | | | | | | This just slightly simplifies adding lots of time-debug stuff in Rails. Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding simplistic param_name/puppet_tag cachingLuke Kanies2009-04-223-2/+22
| | | | | | | This has a drastic affect on performance - cuts about 25% off of the store time. Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding more time debugging to Rails code, and refactoring a bitLuke Kanies2009-04-222-30/+10
| | | | | | | | There is an accumulation in the resource tags (hackish enough but soon to be replaced), and I've fixed a small bug in the tags merging that was causing lots of extra work (like 3x). Signed-off-by: Luke Kanies <luke@madstop.com>
* Refactoring the Rails integrationLuke Kanies2009-04-223-83/+306
| | | | | | | | 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>
* Adding ActiveRecord terminus classes for Node and Facts.Luke Kanies2009-04-221-1/+25
| | | | | | | | | This is most of the way to replacing standard StoreConfigs integration with the Indirector. We still need to convert the Catalog and then change all of the integraiton points (which is mostly the 'store' call in the Compiler). Signed-off-by: Luke Kanies <luke@madstop.com>
* Fix #2010 - add protection code for some storeconfig corruptionBrice Figureau2009-03-041-14/+28
| | | | | | | | | | | | | | This patch adds a more robust and self-healing storedconfig in case of logically corrupted database as the one in #2010 (where multiple resources of same references are present in the database for the same host). The problem is that the resources are stored in a hash with the resource ref as the key, so we collapse resource of different id but same reference. The patch fixed this by using a hash by resource id, and maintaining a list of old extraneous resource in the db that are removved after the storeconfig pass. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Use Puppet.debug instead of own debug flagPeter Meier2009-02-221-7/+5
| | | | | | It's better to use puppet's logging environment than an own. Especially if the default is quite verbose and can't be set by config flag.
* Fix #1972 - ActiveRecord fixes resulted in broken testsBrice Figureau2009-02-151-3/+4
| | | | | | | Fix #1930 was not complete, with some typos and misuse of unused code paths in the regular puppetmaster use case. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fixed #1959 - Added column protection for environment schema migrationJames Turnbull2009-02-121-2/+6
|
* Change the way the tags and params are handled in railsBrice Figureau2009-02-062-23/+88
| | | | | | | | | | | | | 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>
* Add methods to return hash instead of objects to params and tagsBrice Figureau2009-02-062-12/+49
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Rename migration so it's still appliedThom May2008-11-261-0/+0
|
* Slight denormalisation to store a host's environment as a first classThom May2008-11-263-0/+14
| | | | | object in the database Fixes: #1392
* id column is autogenerated by rails as a primary key, there is no needBrice Figureau2008-08-222-8/+17
| | | | | | | to create an additional index on this column. This changeset contains the new schema and a migration. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1052 - abysmal storeconfig performance - part1Brice Figureau2008-08-171-1/+1
| | | | | | | | | | | | | | Resources whose references are of the form: Main::Sub1::Sub2 are extracted from the database under the form: Main::sub1::sub2 Puppet then fails to match them against compiled resources of same references which are capitalized as they should, and tries to overwrite them on every storeconfig run, leading to tons of cascading DELETE/INSERT, hurting performance. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1510 - storeconfig fails with rails 2.1Brice Figureau2008-08-171-5/+5
| | | | | | | | This is a workaround. Since rails seems to have difficulties to map associations to Puppet classes, we explain it carefully what to expect. Changelog
* Replacing all two-space indents with four-spaceLuke Kanies2008-06-131-14/+14
|
* Pushed schema patch for #1193James Turnbull2008-04-172-0/+10
|
* * Tweaks for puppetshow UI cleanupBlake Barnett2008-02-285-3/+17
|
* * Add migration for "created_at" (hobo expects it)Blake Barnett2008-02-287-139/+17
| | | | | * Tweaks for puppetshow interface cleanup * Delete unused tagging lib and puppet_class model
* Fixing #923 (again). The host storage method was notLuke Kanies2007-12-101-3/+1
| | | | | | correctly searching for the host, so it was creating a new host on each run, which is what was causing the conflict.
* Theoretically, this patch is to fix #917 (which it does), butLuke Kanies2007-11-281-3/+1
| | | | | | | | | | | | | | | | | | | 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.
* Removing the Id tags from all of the filesLuke Kanies2007-10-035-5/+0
|
* Fixed #784 by applying patch by vvidic.Michael V. O'Brien2007-09-111-1/+1
|
* A round of bugfixing. Many more tests now pass -- I think we are largely ↵Luke Kanies2007-08-202-14/+8
| | | | down to tests that (yay!) fail in trunk.
* Undo previous commit, which was an errorlutter2007-08-031-24/+5
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2735 980ebf18-57e1-0310-9a29-db15c13687c0
* Do not set any options if they aren't set in /etc/sysconfig/puppetmaster - ↵lutter2007-08-031-5/+24
| | | | | | otherwise we clobber settings from puppet.conf git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2734 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #695 -- resource references will correctly serialize and unserialize ↵luke2007-07-182-2/+20
| | | | | | in the db git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2706 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #703, mostly. You still cannot do multi-condition queries, but you ↵luke2007-07-181-0/+5
| | | | | | can at least query against any parameter, and matching any value is sufficient for a match, so the tags work fine. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2705 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #689, although I have not added unit tests. The problem was that a ↵luke2007-07-051-1/+2
| | | | | | 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
* Fixing some failing tests.luke2007-06-181-0/+1
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2616 980ebf18-57e1-0310-9a29-db15c13687c0
* All rails and language tests now pass again. All of the rails tests should ↵luke2007-06-171-6/+9
| | | | | | 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
* Fixing the type/title index for mysqlluke2007-06-151-1/+8
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2590 980ebf18-57e1-0310-9a29-db15c13687c0