summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | (#6490) Add plugin initialization callback system to coreMarkus Roberts2011-04-063-5/+100
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The recurring pattern "drop-in code needs to have something done at startup" is presently being solved with a variety of ad-hock mechanism. This commit adds a general, extensible, centralized system for adding such hooks and manages an extensible set of metadata about plugins which it collects by searching for files named "plugin_init.rb" in a series of directories. Initially, these are simply the $LOAD_PATH. Applications can add more places to look for plugins without risk of adding duplicates or changing the order of ones that have already been found with: Puppet::Plugins.look_in(*paths) The contents of each file found is executed in the context of a Puppet::Plugins object (and thus scoped). An example file might contain: ------------------------------------------------------- @name = "Greet the CA" @description = %q{ This plugin causes a friendly greeting to print out on a master that is operating as the CA, after it has been set up but before it does anything. } def after_application_setup(options) if options[:application_object].is_a?(Puppet::Application::Master) && Puppet::SSL::CertificateAuthority.ca? puts "Hey, this is the CA! Hi everyone!!!" end end ------------------------------------------------------- Note that the instance variables are local to this Puppet::Plugin (and so may be used for maintaining state, etc.) but the plugin system does not provide any thread safety assurances, so they may not be adequate for some complex use cases. Presently supported hooks: before_application_preinit( :application_object => ... ) after_application_preinit( :application_object => ... ) before_application_parse_options( :application_object => ... ) after_application_parse_options( :application_object => ... ) before_application_setup( :application_object => ... ) after_application_setup( :application_object => ... ) before_application_run_command( :application_object => ... ) after_application_run_command( :application_object => ... ) on_commandline_initialization(:command_line_object => ... ) on_application_initialization(:appliation_object => ... ) Paired-with: Daniel Pitman
* | | (#5908) Add support for new update-rc.d disable APIMax Martin2011-03-301-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support for the new disable API to update-rc.d and added spec tests to check this functionality. This change was made because in versions of sysv-rc >= 2.88, 'update-rc.d stop' is broken and actually enables the service. We only changed the disable case as the enable case still works on systems which use sysv-rc 2.88 or greater (atm, only Debian Lenny). We wanted to change as little as possible because update-rc.d prints a message stating that the new enable/disable API is unstable and may change in the future. Paired-with:Matt Robinson, Jacob Helwig
* | | Merge branch 'tickets/2.6.x/6256' into 2.6.nextJames Turnbull2011-03-262-1/+2
|\ \ \ | | | | | | | | | | | | | | | | * tickets/2.6.x/6256: Fixed #6256 - Creation of rrd directory.
| * | | Fixed #6256 - Creation of rrd directory.James Turnbull2011-03-262-1/+2
| |/ / | | | | | | | | | Added :metrics to the settings used by the master
* | | Merge branch 'ticket/2.6.next/5477' into 2.6.nextJesse Wolfe2011-03-255-10/+5
|\ \ \
| * | | (#5477) Allow watch_file to watch non-existent files, especially site.ppJesse Wolfe2011-03-255-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The watch_file mechanism would refuse to monitor paths to files that didn't exist. This patch makes it possible to watch a file that hasn't been created yet, so when it is created, you manifests will get reparsed. Backported this change to 2.6.x Paired-With: Jacob Helwig <jacob@puppetlabs.com>
* | | | Merge branch 'ticket/2.6.next/5221' into 2.6.nextNick Lewis2011-03-241-0/+1
|\ \ \ \ | |/ / / |/| | |
| * | | (#5221) Fix fileset path absoluteness checking with trailing slashJames Turnbull2011-03-241-0/+1
| | | | | | | | | | | | | | | | | | | | Reviewed-By: Nick Lewis Reviewed-By: Pieter van de Bruggen
* | | | Merge branch 'feature/2.6.next/4576' of https://github.com/bodepd/puppet ↵Jesse Wolfe2011-03-241-1/+1
|\ \ \ \ | | | | | | | | | | | | | | | into 2.6.next
| * | | | (4576) - if ENC declares invalid class, it is logged at warning.Dan Bode2011-03-161-1/+1
| | |/ / | |/| | | | | | | | | | | | | | used to be at info, so you had to run the master on verbose to see it an ENC was trying to declare a class that could not be loaded.
* | | | (#4769) Fix negative timeout support for newer rubiesNick Lewis2011-03-241-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In new versions of Ruby, negative timeouts are unsupported. So munge negatives to zero in the parameter. Reviewed-By: Jacob Helwig
* | | | Merge branch 'tickets/2.6.x/6562' into 2.6.nextJames Turnbull2011-03-221-1/+0
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | * tickets/2.6.x/6562: Fixed #6562 - Minor kick documentation fix
| * | | | Fixed #6562 - Minor kick documentation fixJames Turnbull2011-03-221-1/+0
| | | | |
* | | | | Merge branch 'ticket/2.6.next/6658' into 2.6.nextMatt Robinson2011-03-181-2/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * ticket/2.6.next/6658: (#6658) Propagate ENC connection errors to the agent
| * | | | | (#6658) Propagate ENC connection errors to the agentMatt Robinson2011-03-181-2/+1
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the master failed to run the External Node Classifier script it would log an error on the master, but the agent didn't get back the full error or the stack trace for it's logs. By raising when there's an ENC script problem on the master, this causes the error messages to propagate to the agent. Paired-with: Jacob Helwig <jacob@puppetlabs.com>
* | | | | Merge branch ↵Max Martin2011-03-175-159/+197
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'feature/2.6.next/4884-an-exec-provider-that-executes-unfiltered-bash-code' into 2.6.next * feature/2.6.next/4884-an-exec-provider-that-executes-unfiltered-bash-code: (#4884) Revise new exec tests, add a few more (#4884) Add an shell provider for execs (#4884) Fix Test::Unit exec tests (#4884) Break the exec type out to have a posix provider (#4884) Add consistent path validation and behavior (#4884) Add expand_path to requiring the spec_helper (#4884) Autorequire shared behaviors and method to silence warnings (#4884) Fix whitespace (#4884) Get rid of open3 require since it wasn't being used
| * | | | (#4884) Revise new exec tests, add a few moreMax Martin2011-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revised a few of the new tests for the exec type and provider to ensure that they were testing what they meant to, and added in a couple of new tests. Reviewed-by:Daniel Pittman
| * | | | (#4884) Add an shell provider for execsMatt Robinson2011-03-151-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it possible to use shell builtins when the exec is inline bash commands. Paired-with: Max Martin
| * | | | (#4884) Break the exec type out to have a posix providerDaniel Pittman2011-03-152-156/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is in preparation for allowing other new providers to handle exec commands differently. Reviewed-by: Max Martin and Matt Robinson
| * | | | (#4884) Add consistent path validation and behaviorDaniel Pittman2011-03-152-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many path parameters were implementing their own inconsistent validation and behavior. Now those parameters can have a parent class that makes things a lot more consistent. Reviewed-by: Matt Robinson and Max Martin
| * | | | (#4884) Get rid of open3 require since it wasn't being usedMatt Robinson2011-03-151-3/+1
| | | | | | | | | | | | | | | | | | | | Paired-with: Max Martin
* | | | | Updated CHANGELOG for 2.6.7rc1Matt Robinson2011-03-161-1/+1
| | | | |
* | | | | Merge branch 'ticket/2.6.next/5073' into 2.6.nextMatt Robinson2011-03-162-1/+9
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * ticket/2.6.next/5073: (#5073) Download plugins even if you're filtering on tags
| * | | | | (#5073) Download plugins even if you're filtering on tagsMatt Robinson2011-03-152-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we eval a resource in transaction.rb it was being skipped when filtering on tags and downloading the plugins. There's a lot of complicated conditions for whether to skip a resource, but this is a condensed version of the path that was causing plugins not to be downloaded. skip? missing_tags? !ignore_tags? !host_config The Puppet::Configurer::Downloader creates separate catalogs and applies them to get custom facts and plugins, so should be setting host_config to false. Puppet::Util::Settings also sets host_config to false when you call use on settings, while normal catalog application defaults to true. Thanks to Stefan Schulte <stefan.schulte@taunusstein.net> for suggesting the implementation fix.
* | | | | | Fix #5610: Prevent unnecessary RAL lookupsJesse Wolfe2011-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Reviewed-By: Paul Berry <paul@puppetlabs.com>
* | | | | | Revert "Merge branch 'ticket/2.6.x/5605' of ↵Jesse Wolfe2011-03-153-15/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://github.com/stschulte/puppet into 2.6.next" This reverts commit 658bdb72bee3ad664627a71793213e6540afd5cb, reversing changes made to 4c9bd43bc2f5fde9d86196e8689dced929d39aad. See comment at http://projects.puppetlabs.com/issues/5605#note-9
* | | | | | Merge branch 'ticket/2.6.x/5605' of git://github.com/stschulte/puppet into ↵Jesse Wolfe2011-03-153-4/+15
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | 2.6.next
| * | | | | | (#5605) Prefetch doesnt work with composite keysStefan Schulte2010-12-233-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The uniqueness_key method of a type or resource object should return a key that can be used to identify this resource. In fact puppet seldomly uses this method and instead uses resource[:name] as an identifier. While this is totally fine for resourcetypes with a single key_attribute (and resource[:name] returning the namevar), it breaks things as soon as one creates a type with a composite key (prefetching for example is broken). To ease the process of replacing calls to resource[:name] to resource.uniqueness_key, the method uniqueness_key now just returns name_var if there is only one key_attribute (immitating self[:name]) and only returns an array of all the values of all the key_attributes if we have more than one key_attribute. The resourcehash which is passed to providers in their prefetch method is now build with uniqueness_key as the hashkey. Because of the new behaviour of uniqueness_key we hopefully wont break existing providers while allowing new providers for types with composite keys to implement correct prefetch methods.
* | | | | | | (#6723) Fix withenv environment restoration bugMax Martin2011-03-151-5/+4
| |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensured that withenv properly restores the environment after it runs a block and added testing for the method. Reviewed-by: Matt Robinson and Daniel Pittman
* | | | | | Merge branch 'ticket/2.6.next/5428-handle-0.25.x-storedconfig-data' into ↵Jacob Helwig2011-03-151-18/+21
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2.6.next * ticket/2.6.next/5428-handle-0.25.x-storedconfig-data: Remove extra trailing whitespace from lib/puppet/resource.rb (#5428) More fully "stub" Puppet::Resource::Reference for use with storedconfigs Conflicts: lib/puppet/resource.rb
| * | | | | | Remove extra trailing whitespace from lib/puppet/resource.rbJacob Helwig2011-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Paired-with: Daniel Pittman <daniel@puppetlabs.com>
| * | | | | | (#5428) More fully "stub" Puppet::Resource::Reference for use with storedconfigsJacob Helwig2011-03-151-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Puppet::Resource::Reference class wasn't stubbing enough of the 0.25.x behavior to satisfy the needs of storedconfigs. Since P::R::Reference, and Puppet::Resource were merged as part of 2.6.x, we can pretend that P::Resource is P::R::Reference for the purposes of loading data from storedconfigs. This should still satisfy the over-the-wire serialization needs of 0.25.x. This also changes internal references to @parameters in Puppet::Resource(::Reference) to go through a parameters method. This allows us to "initialize" this instance variable lazily, since loading via YAML bypasses the normal initialize method. Paired-with: Daniel Pittman <daniel@puppetlabs.com> Reviewed-by: Markus Roberts <markus@puppetlabs.com>
* | | | | | | Merge branch 'ticket/2.6.next/6689' into 2.6.nextNick Lewis2011-03-151-1/+0
|\ \ \ \ \ \ \ | |_|_|/ / / / |/| | | | | |
| * | | | | | (#6689) Remove extraneous include of Puppet::Util in InventoryActiveRecordNick Lewis2011-03-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was added while developing in order to benchmark, but wasn't removed before committing. Reviewed-By: Jacob Helwig
* | | | | | | Merge branch 'ticket/2.6.x/5662' of https://github.com/stschulte/puppet into ↵Jesse Wolfe2011-03-141-1/+3
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2.6.next Manually Resolved Conflicts: spec/unit/provider/mount/parsed_spec.rb
| * | | | | | | (#5662) Parsedfile doesnt work with mult keyattrStefan Schulte2010-12-231-1/+3
| | |_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When one wants to use the parsedfile provider for a type with more than one key_attribute (e.g. a type for entries in /etc/services with name and protocol as key_attributes) the provider will not store all key_attributes in property_hash and not all keyattributes will be visible in the to_line function. The create method of parsedfile will only put validproperties into the propertyhash. As result :name and all the other key_attributes will not be set. In the flush method however the :name parameter is put in the property_hash but the method does not handle other keyattributes. This patch modifies flush to put all key_attributes into the property hash (Note: @resource.name is basically just an alias for @resource[:name])
* | | | | | | Merge branch 'ticket/2.6.x/5661' of https://github.com/stschulte/puppet into ↵Jesse Wolfe2011-03-141-4/+4
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | 2.6.next
| * | | | | | | (#5661) Creating types dont work with >1 namevarStefan Schulte2010-12-231-4/+4
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The methods [] and []= of type.rb are handling :name in a special way. When someone wants to access resource[:name] puppet tries to replace :name with the name_var. If the type has more than one key_attribute name_var is always returning false so we'll get the error Resource type <resourcetype> does not support parameter false This patch doesnt try to substitute :name if we dont have a single namevar, aka. we have more than one key_attribute
* | / / / / / (#6707) Fix typo in rest_authconfig.rbnfagerlund2011-03-141-1/+1
| |/ / / / / |/| | | | | | | | | | | | | | | | | "Where" -> "were." Capitalize "ACL."
* | | | | | (#6689) Make inventory_active_record terminus search quicklyNick Lewis2011-03-114-22/+16
| |_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This terminus behaves the same on all supported DB platforms, by performing a limited portion of its query in SQL, and the rest of the comparison in Ruby. Its results are consistent with the YAML terminus. Paired-With: Jesse Wolfe
* | | | | Merge branch 'ticket/2.6.next/5392' into 2.6.nextMatt Robinson2011-03-091-4/+5
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * ticket/2.6.next/5392: (#5392) Give a better error when realizing a non-existant resource
| * | | | | (#5392) Give a better error when realizing a non-existant resourceMatt Robinson2011-03-091-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | You can reproduce the error with a simple manifest Bogus_type <| title == 'foo' |> We used to fail because find_resource_type returned nil and we never checked if it was nil before calling methods on it. Reviewed-by: Max Martin <max@puppetlabs.com>
* | | | | | Merge branch 'tickets/2.6.x/2645' into 2.6.nextJesse Wolfe2011-03-092-1/+17
|\ \ \ \ \ \
| * | | | | | Fixed #2645 - Added support for creating system usersJames Turnbull2011-03-092-1/+17
| | |_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Red Hat, Ubuntu, Debian and deriatives the -r flag allows creation of "system" users with a UID below that defined in /etc/login.defs. This commit adds support for a system parameter and a system_users feature which can be used like so: user { "foo": system => true, ensure => present, } This will create a user with a lower UID. The system parameter defaults to false.
* | | | | | Merge branch 'maint/2.6.next/6338' into 2.6.nextNick Lewis2011-03-095-44/+40
|\ \ \ \ \ \ | |_|/ / / / |/| | | | |
| * | | | | maint: Remove serialization of InventoryFact valuesNick Lewis2011-03-092-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is not necessary because fact values are always strings, and it wasn't doing the unnecessary job it was expected to do anyway.
| * | | | | maint: Rename InventoryHost to InventoryNodeNick Lewis2011-03-095-40/+40
| | | | | | | | | | | | | | | | | | | | | | | | This had been conflating hosts and nodes, when nodes is the most accurate.
* | | | | | maint: Remove spec run noiseMatt Robinson2011-03-081-1/+1
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were some warnings and stack traces in the spec output that aren't necessary. The only interesting fix is of the message: lib/puppet/module.rb:79 warning: multiple values for a block parameter (0 for 1) from lib/puppet/util/logging.rb:30 If you call any form of logging on a module you end calling the file method on the module just because logging always checks for that method and calls it if it's defined, but in this case it's not defined in the way that logging expected so passes the wrong paramters. The easy solution is just to call logging on Puppet, which makes sense in this case anyway, and I don't think it's worth a separate ticket to deal with that logging warning. Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* | | | | Merge branch 'ticket/2.6.next/6338' into 2.6.nextNick Lewis2011-03-085-0/+191
|\ \ \ \ \
| * | | | | (#6338) Support searching on metadata in InventoryActiveRecord terminusNick Lewis2011-03-081-7/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Timestamps are currently the only supported metadata for searching. Paired-With: Max Martin Reviewed-By: Jacob Helwig