summaryrefslogtreecommitdiffstats
path: root/spec
Commit message (Collapse)AuthorAgeFilesLines
...
| * | (#6949) Fix passing positional arguments to actions.Daniel Pittman2011-04-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | We had a logic failure that didn't pass positional arguments at all, but which our testing didn't verify. This entirely broke things. Now fixed, and a test added to ensure we don't bug out further... Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | (#6964) use 'when_invoked' rather than 'invoke' for actions.Daniel Pittman2011-04-045-36/+36
| | | | | | | | | | | | | | | | | | | | | In the DSL we want to use 'when_invoked do' because it reads much more naturally for users. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | maint: added testing to ensure we inherit options correctly.Daniel Pittman2011-04-041-0/+16
| | |
| * | (#6749) Handle options with inline arguments.Daniel Pittman2011-04-041-0/+6
| | | | | | | | | | | | | | | | | | | | | We didn't correctly handle '--foo=bar' as having supplied an argument during the pre-parse phase. Now we have a test for it, and a fix in the code. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| * | (#6749) Extract the action from the arguments cleanly.Daniel Pittman2011-04-041-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a test to verify that we are correctly removing the action name from the set of arguments passed to the string action, then cleans up the previous code so we don't need to mutilate the command line arguments: we can just extract it from the resultant set of information. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| * | (#6749) Fix optional vs mandatory argument handling.Daniel Pittman2011-04-041-8/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | optparse will treat '--foo --bar' as "foo with the argument --bar" when foo takes a mandatory argument. We need to emulate that behaviour in our pre-parse of the command line. Incidentally, fix up a bug in boolean options, and improve our testing. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| * | (#6749) Polish the CLI option pre-parse implementationDaniel Pittman2011-04-041-49/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This improves handling of the pre-parse of the command line to be non-destructive, which cuts down the volume of garbage generated in the process. It also improves testing to verify that we get the darn thing right... Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | (#6749) clean up various testing bits...Daniel Pittman2011-04-042-15/+23
| | | | | | | | | | | | | | | | | | | | | This cleans up a whole bunch of bits of the testing code around the place; nothing revolutionary, just nicer and more robust code. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | (#6760) set terminus in indirector string base class.Daniel Pittman2011-04-042-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now accept a terminus option to each invocation, and set the terminus based on that call. This is probably incomplete, because it only sets the terminus when given, and doesn't try to reset it to the default afterwards. This also resets the terminus class after every invocation, to stop it leaking state across calls. This make, sadly, have some effects if you are not just using the strings to invoke the terminus, but it beats having the strings broken as well... Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | (#6749) Start porting existing strings to the options API.Daniel Pittman2011-04-045-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | This provides a solid test of the new code, by migrating the existing strings to match. This also gives us a chance to determine any weak points in the code as written. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | (#6749) code and test cleanup of Application/StringBase.Daniel Pittman2011-04-041-5/+12
| | | | | | | | | | | | | | | | | | | | | This removes dead code now we have terminus in the base string, and disables some tests on StringBase app until they can be rewritten. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | (#6749) string cli base: implement preinit CLI parsingDaniel Pittman2011-04-042-8/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to identify the full set of options we need to know the action that is being invoked; that actually requires a pre-processing step to identify that out of the global options. Notably, our spec is that options can be to the right of their declaration point, but not to the left: that means that we can now extract the full set of options, and interact with the standard Puppet option handling code, resulting in at least vaguely saner behaviour... Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | (#6749) detect duplicate aliases in a single option statement.Daniel Pittman2011-04-041-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures that an option declaration that shadows itself is found, and reported to the user, rather than silently eating one of the two. This could have actually lost, for example, the distinction between an argument-requiring and an argument-missing variant of the same thing. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | (#6749) fix an inheritance bug in ActionManagerDaniel Pittman2011-04-041-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | 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-157/+243
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-045-2/+320
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | (#6758) Pass options as an argument to string actions.Daniel Pittman2011-04-022-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: delete a test that can't work on 2.6.Daniel Pittman2011-04-021-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | The methods being tested are not available in the 2.6 series, and the test itself is relatively weak, so rather than try to fix it we eliminate it in favour of other testing of the same behaviour. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | MAINT: implement a pending test for code we wrote...Daniel Pittman2011-04-021-1/+11
| | | | | | | | | | | | | | | | | | | | | We had an outstanding pending test for code we wrote, and which we were not actually testing stand-alone. This implements the test for that. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | MAINT: use a table for table-style tests...Daniel Pittman2011-04-021-14/+5
| | | | | | | | | | | | | | | | | | | | | | | | We had a series of tests that vary only on one input, and which wanted to validate that the same failure happened after every instance; reducing this to a set of input data lets us reduce code duplication in the tests. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | MAINT: fix up tests that depend on the LoadError message to work.Daniel Pittman2011-04-021-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We depend on require throwing about a specific file on disk, rather than just generically, to ensure that we don't consume load errors from existing files. This means our tests need to be updated to reflect that, by raising with appropriate text when they stub require. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | maint: Use bracket notation instead of define in specsNick Lewis2011-03-2914-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | The intent of these specs is to find the String rather than to actually define it. Thus, the bracket notation is more semantically accurate than using Puppet::String#define. Reviewed-By: Pieter van de Bruggen
| * | (#6770) Change versioning; adopt :current over :latest.Pieter van de Bruggen2011-03-283-124/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2830-236/+236
| | | | | | | | | | | | | | | | | | | | | 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>
| * | (#6770) Add support for version :latest.Pieter van de Bruggen2011-03-253-1/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+102
| | | | | | | | | | | | Reviewed-By: Jacob Helwig
| * | (#6770) Refactor Puppet::Interface#initialize.Pieter van de Bruggen2011-03-255-20/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+6
| | | | | | | | | | | | | | | | | | | | | 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-241-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | (Maint.) Require 'puppet/interface' in spec_helper.rbPieter van de Bruggen2011-03-231-0/+1
| | | | | | | | | | | | Paired-With: Nick Lewis
| * | Merge branch 'tickets/master/6770'Pieter van de Bruggen2011-03-2319-66/+72
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | 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-2315-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2319-43/+43
| | | | | | | | | | | | | | | | | | | | | | | | 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-2319-63/+75
| | | | | | | | | | | | | | | | Reviewed-By: Nick Lewis
| * | | WIP - all tests failLuke Kanies2011-03-221-0/+8
| | | | | | | | | | | | | | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | Factoring cert status app back into certificate.Richard Crowley2011-03-231-0/+21
| | | |
| * | | maint: Fix order-dependent spec failuresNick Lewis2011-03-222-6/+11
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | The specs for InterfaceCollection were clearing the list of interfaces at the end of the spec run, which caused later specs to fail because they couldn't re-require interfaces they needed. This fixes the InterfaceCollection specs to save and restore the interfaces at the end of the file. Reviewed-By: Matt Robinson
| * | maint: Implement an InterfaceCollection class to manage interfacesNick Lewis2011-03-2217-266/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-223-33/+185
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | 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-223-33/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2214-54/+40
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-212-24/+0
| | | | | | | | | | | | Reviewed-By: Nick Lewis
| * | (#6805) Add a "configurer" applicationNick Lewis2011-03-213-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | (#6806) Improve error checking and reporting for interface naming.Daniel Pittman2011-03-211-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | (#6786) Fixing a number of failing tests.Pieter van de Bruggen2011-03-2112-24/+24
| | | | | | | | | | | | | | | | | | | | | 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-13/+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
| * | Fixing #16 - nodes default to yamlLuke Kanies2011-03-021-0/+4
| | | | | | | | | | | | | | | | | | 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-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+3
| | | | | | | | | | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | Fixing plugin usageLuke Kanies2011-02-241-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>