summaryrefslogtreecommitdiffstats
path: root/lib/puppet
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | | | | | (#6749) fix an inheritance bug in ActionManagerDaniel Pittman2011-04-041-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we wrote class inheritance of actions for strings we didn't implement method (ahem, action) lookup correctly. This changes that, by providing the implementation to our standards, along with appropriate tests. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | | | | | | | | | (#6749) implementing option handling in CLI string wrapperDaniel Pittman2011-04-048-47/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The purpose of this is to adapt the generic option support in our strings to the command line; we adapt the generic option information to optparse, and establish our environment early in the process to ensure that we can play nice with Puppet::Application for the moment. In the process we ensure that we detect, and report, conflicts in option naming across the board. Additionally, when an option is declared with multiple aliases, we insist that either all, or none, of them take an argument. To support this we support introspecting options having an optional argument, as well as documentation and all. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | | | | | | | | | (#6749) Implement support for options on strings and actions.Daniel Pittman2011-04-047-18/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to support both strings and actions specifying options, to support generic wrappers that present strings to the user across multiple distinct front-ends. At the moment we focus on implementation of a generic CLI providing full control to all the strings, but we aim to support other programmatic interfaces including Ruby and RPC invocation as part of the overall change. We also detect, at the time they are declared, duplicate options. They are reported, like any duplicate, with an error thrown. Specifically: It is illegal to declare a duplicate option in the same scope, such as within the same string, or within the same action. This is unchanged. It is illegal to declare an option in an action that duplicates an option in the string, or vice-versa. This is reported when the duplicate is declared, so may report on either the string or action depending on sequence. It remains legal to duplicate the same option across multiple actions, with different meanings. There is no conflict, as the same option can't be passed to both simultaneously. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | | | | | | | | | MAINT: nicer to_s for actions, for user-focused rendering.Daniel Pittman2011-04-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it possible for us to just print the Action object directly and get a human-focused output string. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | | | | | | | | | (#6758) Pass options as an argument to string actions.Daniel Pittman2011-04-022-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Earlier in their implementation the String prototype would set global state on a String object to reflect options set on the command line. As we move strings away from a CLI-only prototype, this becomes troublesome because we can easily have, for example, HTTP access to a string, which means load balancers can really make this confusing. It also encourages global state pollution, where one invocation can adversely influence another. A better approach is that we pass options to the string action invocation directly; this makes the interaction stateless. Changes required to your code to adapt to the new world: - action(:foo) do |some, args| + action(:foo) do |some, args, options={}| if options[:whatever] then Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | | | | | | | | | MAINT: fix error reporting when you set terminus incorrectly.Daniel Pittman2011-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we tried to invoke a class method on an instance, and threw another exception, which wasn't the most helpful behaviour. This fixes that to correctly report the array of available terminus classes to the user. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | | | | | | | | | (Maint) Bugfix for failing requires inside Puppet Strings.Pieter van de Bruggen2011-03-301-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Paired-With: Matt Robinson
| * | | | | | | | | | (#6770) Fix Puppet::String#load_actions.Pieter van de Bruggen2011-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed-By: Nick Lewis
| * | | | | | | | | | (#6770) Change versioning; adopt :current over :latest.Pieter van de Bruggen2011-03-2818-60/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per discussion with Luke, versions of an interface are first looked up by requiring 'puppet/interface/{name}', and secondarily looked up by requiring '{name}@{version}/puppet/interface/{name}' if the first failed. A version of `:current` can be used to represent the version living in 'puppet/interface/{name}'. Paired-With: Nick Lewis
| * | | | | | | | | | MAINT: the API is officially named "string" as of this moment.Daniel Pittman2011-03-2836-172/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we have settled on the final public name for the API, "Puppet::String", mass-rename and mass-edit all the files to follow. Reviewed-By: Randall Hansen <randall@puppetlabs.com>
| * | | | | | | | | | MAINT: fix the misordered invocations in action.Daniel Pittman2011-03-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When initializing we need to set the name and interface before we do anything else, since the reasonable assumption for users is that those invariants are there when their setter is called. This allows someone to override the interface or name by misusing the call to new, but they could already screw up by passing the wrong values, so whatever.
| * | | | | | | | | | (#6770) Add support for version :latest.Pieter van de Bruggen2011-03-253-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifying a version of `:latest` will find the most recent version of the named interface installed in your RUBYLIB, and attempt to load that. This is unlikely to provide a stable dependency in the future, so should be used sparingly, acknowledging the dangers. Reviewed-By: Daniel Pittman
| * | | | | | | | | | (#6770) Add version lookup and comparison.Pieter van de Bruggen2011-03-251-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed-By: Jacob Helwig
| * | | | | | | | | | (#6770) Refactor Puppet::Interface#initialize.Pieter van de Bruggen2011-03-252-14/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | P::I#initialize now takes a name and a version (and an optional block). The options hash has been removed, though it may be reintroduced if a legitimate use case can be made for it (so far, it's only been used for the version number). Reviewed-By: Jacob Helwig
| * | | | | | | | | | Config#print action always returns nilLuke Kanies2011-03-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were returning 'true', which was getting printed unnecessarily. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | | | | | | | | (#6833) support 'script' as a short form of 'action'Daniel Pittman2011-03-243-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment the action method is a fairly heavy tool: it provides a DSL, and is designed to allow substantial metadata to be added to the action. For some users this is low on value, since they just want to write a little script that drives things a bit differently. Which there is substantial value in the metadata, adding the capability to do these light-weight things quickly is valid. To meet this we add a script action; the contrast is: action :foo do # other metadata goes here invoke do |args| # method body goes here end end script :bar do |args| # method body goes here end # ...and if you want metadata, you have to add it in more ugly, procedural # ways, which we are not going to encourage. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | | | | | | | | | Merge branch 'tickets/master/6770'Pieter van de Bruggen2011-03-2327-87/+96
| |\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: lib/puppet/interface/certificate.rb spec/unit/application/interface_base_spec.rb spec/unit/interface/interface_collection_spec.rb
| | * | | | | | | | | | (#6770) Rename Puppet::Interface::interface method.Pieter van de Bruggen2011-03-2319-47/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Puppet::Interface::interface is now Puppet::Interface::define, also aliased to Puppet::Interface::[] for convenience. Paired-With: Nick Lewis
| | * | | | | | | | | | (#6770) Changing versioning to semver.Pieter van de Bruggen2011-03-2325-50/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More information about the versioning scheme can be found at http://semver.org. Paired-With: Nick Lewis
| | * | | | | | | | | | (#6770) Add basic versioning for interfaces.Pieter van de Bruggen2011-03-2327-68/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed-By: Nick Lewis
| * | | | | | | | | | | Propagating an argument to search out of core.Richard Crowley2011-03-231-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Puppet::SSL::Host.search (which will proxy to the new indirection) accepts an array of classes (now also class names) to limit the search. Currently, `puppet certificate list` limits itself to certificate requests to mimic the behavior of `puppet cert -l`.
| * | | | | | | | | | | Added list action.Richard Crowley2011-03-232-12/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The common tasks of checking the --ca-location argument and becoming a CA process if necessary (that is, acting like a master) have been abstracted into the Application where they belong.
| * | | | | | | | | | | Alter generate action to work on CSRs only.Richard Crowley2011-03-231-3/+4
| | | | | | | | | | | |
| * | | | | | | | | | | Adding Certficate#generateLuke Kanies2011-03-221-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | | | | | | | | | WIP - all tests failLuke Kanies2011-03-222-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | | | | | | | | | Use the new name for the terminus.Richard Crowley2011-03-232-8/+2
| | | | | | | | | | | |
| * | | | | | | | | | | Factoring cert status app back into certificate.Richard Crowley2011-03-232-0/+30
| |/ / / / / / / / / /
| * | | | | | | | | | maint: Implement an InterfaceCollection class to manage interfacesNick Lewis2011-03-2217-74/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having an instance variable on class Interface is insufficient for Interface::Indirector. This also changes the semantics of "Interface.interface" to handle registration and loading actions, and for "Interface.new" to only instantiate an Interface. Thus, consumers of the API should typically use "Interface.interface", unless they have reasons to not want an interface automatically registered. Paired-With: Pieter van de Bruggen
| * | | | | | | | | | Merge branch 'ticket/master/6814'Nick Lewis2011-03-221-0/+1
| |\ \ \ \ \ \ \ \ \ \
| | * | | | | | | | | | (#6814) Add missing require for specsNick Lewis2011-03-221-0/+1
| | | | | | | | | | | |
| * | | | | | | | | | | maint: Make args to Catalog.select explicitNick Lewis2011-03-221-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No other args are used, so passing *args and shifting is unnecessary.
| * | | | | | | | | | | Merge branch 'ticket/master/6814'Nick Lewis2011-03-2210-75/+138
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: lib/puppet/interface/catalog.rb lib/puppet/interface/catalog/select.rb lib/puppet/interface/configurer.rb
| | * | | | | | | | | | (#6814) Create a dedicated Action classNick Lewis2011-03-2210-75/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class will represents an action, and allows us to store metadata for an action, and programmatically introspect and invoke them. A helper class ActionBuilder represents the DSL for defining an action. Also defined an "invoke" DSL method to handle the functionality of defining the method for an action. Reviewed-By: Daniel Pittman
| * | | | | | | | | | | (#6786) Change interface storage and access.Pieter van de Bruggen2011-03-226-28/+32
| |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ruby's namespace mechanism introduced a number of problems, including incorrect name resolution for common and simple cases. Given that, we've refactored back to class-level data structures with accessor methods available. The current method names are unlikely to be the final UI. Reviewed-By: Daniel Pittman
| * | | | | | | | | | (Maint.) Remove Puppet::Interface#unload_interfacePieter van de Bruggen2011-03-211-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed-By: Nick Lewis
| * | | | | | | | | | (#6805) Add a "configurer" applicationNick Lewis2011-03-215-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This application is similar in basic functionality to the "agent" application, but implemented in terms of interfaces. It currently will retrieve facts, retrieve a catalog, apply the catalog, and submit a report. Options such as noop and daemonize are still to come. Reviewed-By: Pieter van de Bruggen
| * | | | | | | | | | Fixing a load-order issue in Puppet::InterfaceLuke Kanies2011-03-212-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The application classes were having issues loading the Interface class in certain circumstances because of load order. This just pushes the loading as late as possible. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | | | | | | | | (#6806) Improve error checking and reporting for interface naming.Daniel Pittman2011-03-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We didn't do enough input checking and sanitization, and missed some edge-cases for naming interfaces. This adds testing, and cleans up some edge cases to handle things better. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | | | | | | | | | (#6785) Internal consistency for `--terminus`.Pieter van de Bruggen2011-03-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Paired-With: Richard Crowley
| * | | | | | | | | | (#6786) Fixing a number of failing tests.Pieter van de Bruggen2011-03-213-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The initial merge of this branch hadn't actually been run against the full suite of specs; a number of specs began failing shortly afterward. Reviewed-By: Daniel Pittman
| * | | | | | | | | | (#6786) Removing the #interface method.Pieter van de Bruggen2011-03-211-20/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since constants are already being defined for each interface, the #interface method does little but provide another way to access the same data. Reviewed-By: Nick Lewis
| * | | | | | | | | | Modifying Facts.upload a bitLuke Kanies2011-03-021-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The functionality is basically the same, but we're no longer using caching, and we log that it happened. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | | | | | | | | Fixing #16 - nodes default to yamlLuke Kanies2011-03-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't have json support for node output yet. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | | | | | | | | Fixing #13 - showconfig moved to indirectorLuke Kanies2011-03-022-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I renamed it to 'info', too. It only showed indirector-related info, so this makes sense. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | | | | | | | | Adding a test for fix to #14Luke Kanies2011-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | | | | | | | | (14) updated interface_base to support multiple command line argumentsDan Bode2011-03-011-1/+2
| | | | | | | | | | |
| * | | | | | | | | | Pretty-printing json using "jj"Luke Kanies2011-02-271-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | | | | | | | | Attempting to skip loading of duplicate actionsLuke Kanies2011-02-241-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | | | | | | | | Fixing plugin usageLuke Kanies2011-02-242-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I had broken some usages of plugins by incorrectly selecting command-line arguments. The fix was to remove the #main method contained in the IndirectionBase subclass. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | | | | | | | | Adding Application options to InterfacesLuke Kanies2011-02-233-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows all of the actions to react to the CLI options. I've also removed the unnecessary 'name' variables I was using in various places - they were just the first of the arguments, and they weren't actually always names. Signed-off-by: Luke Kanies <luke@puppetlabs.com>