summaryrefslogtreecommitdiffstats
path: root/spec/unit/application
Commit message (Collapse)AuthorAgeFilesLines
* maint: use the exit_with helper everywhere...Daniel Pittman2011-04-2213-158/+72
| | | | | | | Now we have the exit_with matcher, we should use it everywhere that we previously stubbed, expected, or caught the exit status in an ad-hoc way. Reviewed-By: Jesse Wolf <jesse@puppetlabs.com>
* Merge remote-tracking branch ↵Daniel Pittman2011-04-211-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 'remotes/lak/tickets/next/7118-summaries_for_all_faces' into 2.7.x Fix conflicts due to version drift in: lib/puppet/face/certificate.rb lib/puppet/face/facts.rb lib/puppet/face/node.rb lib/puppet/face/secret_agent.rb spec/lib/puppet/face/basetest.rb spec/unit/face/help_spec.rb Reviewed-By: Markus Roberts <markus@puppetlabs.com>
| * (7118) Adding summaries for all facesLuke Kanies2011-04-141-0/+1
| | | | | | | | | | | | | | | | | | It's usually just a one-liner, but when I saw an obvious opportunity for longer docs, I've added a @longdocs variable that can be converted to longer forms when ready. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* | (#7181) Rename configurer face to secret_agent.Daniel Pittman2011-04-211-3/+3
| | | | | | | | | | | | | | | | This is a much more useful public name, especially given the code is aimed to eventually replace the agent entirely. Until then this is pleasant enough to talk about. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
* | maint: stop stubbing log level setting.Daniel Pittman2011-04-2010-76/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The underlying problem turned up when another test (as a side effect) changed the logging level to be more verbose, and a very distant test broke. This revealed that we didn't preserve that global state around tests. Fixing that further revealed that we stubbed setting that log level all over the place, as a point fix for the same problem, and to assert the operation of various tools. So, additionally, we strip out all that stubbing, and assert on the desired effect rather than the mechanism for achieving it. Reviewed-By: Max Martin <max@puppetlabs.com>
* | (#7116) Handle application-level options in parse_optionsDaniel Pittman2011-04-201-1/+8
| | | | | | | | | | | | | | | | | | | | We hid another layer of per-application option in the class backing the application, which wasn't correctly handled in the parse_options method. They are now found and handled, so that global flags like --debug work as expected on the left of the action, not just the right. Reviewed-By: Max Martin <max@puppetlabs.com>
* | maint: remove redundant context from the test.Daniel Pittman2011-04-201-103/+101
| | | | | | | | | | | | | | | | We had a block of tests in a describe block inside a describe block; they were literally one hundred percent overlap. Eliminate that and just keep the outer. Reviewed-By: Max Martin <max@puppetlabs.com>
* | (#7013) Wire up rendering hooks on the CLI.Daniel Pittman2011-04-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now find, and call, the appropriate rendering hooks on actions during the rendering phase. This allows the user to intercept and replace the result object that passes through the rest of the rendering system on the fly. Example usage: action :foo do when_rendering :pson do |result| { :whatever => result[a], :foobar => result[b], } end end Reviewed-By: Max Martin <max@puppetlabs.com>
* | (#7013) Handle rendering modes out in the application layer.Daniel Pittman2011-04-191-3/+10
| | | | | | | | | | | | | | | | | | | | | | We no longer establish the rendering mode in the actions; they just default to "nothing", and let that flow on out to the application layer. That lets the facade we put before the face determine the default behaviour. This is mostly a no-op down in the CLI side, but it makes it much easier to integrate into MCollective, HTTP-API, and for other non-CLI users of Faces. Reviewed-By: Max Martin <max@puppetlabs.com>
* | (#7013) Strip out old face-wide rendering defaults.Daniel Pittman2011-04-191-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Now we want to support action-based rendering, it is super-hard to define the semantics around defaulting where things are unspecified: the execution context (CLI, HTTP, etc) vs the face, vs the action all have different semantics. Without solving the problem of how we express all that context and those semantics down in the action, especially one written by a third party, this just becomes a box of counter-intuitive and annoying semantics and edge-cases. Reviewed-By: Max Martin <max@puppetlabs.com>
* | (#7013) better default rendering support for facesDaniel Pittman2011-04-191-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have some specific requirements around rendering, including the ability of authors of actions to add nice, custom rendering. To support that we want solid "basic" rendering for human-focused output. This implements that generic rendering correctly and to spec, to give a sound basis that we can build on for extensible rendering. (#7013) better default rendering support for faces We have some specific requirements around rendering, including the ability of authors of actions to add nice, custom rendering. To support that we want solid "basic" rendering for human-focused output. This implements that generic rendering correctly and to spec, to give a sound basis that we can build on for extensible rendering. Reviewed-By: Max Martin <max@puppetlabs.com>
* | (Maint) Fix a leaking spec, patching intermittent failures.Pieter van de Bruggen2011-04-181-7/+7
| | | | | | Reviewed-By: Matt Robinson.
* | Merge remote-tracking branch 'community/feature/puppet-device' into 2.7.xPieter van de Bruggen2011-04-181-0/+349
| | | | | | | | Reviewed-By: Mike Stahnke
* | (#7131) Remove support for optional arguments to optionsMax Martin2011-04-181-1/+0
| | | | | | | | | | | | | | | | | | As per the design decision documented in #7131, optional arguments to options will no longer be supported. This patch causes such optional arguments to raise an error, and tests for this behavior. Also cleaned up some confusing use of the term "subject" in specs. Paired-with: Daniel Pittman
* | Merge branch ↵Daniel Pittman2011-04-151-4/+3
|\ \ | | | | | | | | | 'feature/2.7.x/6978-face-and-action-options-should-have-hooks-for-various-actions' into 2.7.x
| * | (#7059) Use option hooks for the indirector terminus option.Daniel Pittman2011-04-151-4/+3
| |/ | | | | | | | | | | | | | | We used to open-code terminus setting, which had a bunch of duplicate code. Now, instead, we use the option hooks, resulting in the same behaviour with much less code. Paired-With: Max Martin <max@puppetlabs.com>
* / (#7115) Enable default actions.Pieter van de Bruggen2011-04-151-3/+34
|/ | | | | | | This also enables the 'help' action on the 'help' face to serve as a default action. Reviewed-By: Daniel Pittman Reviewed-By: Nick Lewis
* (#6928) Remove --parseonlyNick Lewis2011-04-132-85/+2
| | | | | | This has been removed in favor of 'puppet parser validate <manifest>'. Paired-With: Jesse Wolfe
* maint: clean up the spec test headers in bulk.Daniel Pittman2011-04-1315-29/+14
| | | | | | | We now use a shebang of: #!/usr/bin/env rspec This enables the direct execution of spec tests again, which was lost earlier during the transition to more directly using the rspec2 runtime environment.
* (#7056) Use 'face' rather than 'faces' in the production code.Daniel Pittman2011-04-134-17/+16
| | | | | | | | | After some discussion we decided that most uses of the Puppet Face infrastructure were about single faces on their own, not about the collection, and so we were better referring to Puppet::Face[...] in code. This implements that by translating names and references in the Ruby code to the new, s-less, name.
* (#6962) Move option handling into #parse_options, not #preinit.Daniel Pittman2011-04-122-27/+38
| | | | | | | | | | | | Logically, the extra work around option parsing for faces belongs in the application parse_options method, not hidden in the step before. This commit moves that to the right place and fixes the fallout from that strange early design decision. Along the way we unify error reporting for invalid options so that all the code paths result in the same externally detected failures. Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* (#6962) delegate global usage to the help face.Daniel Pittman2011-04-121-13/+1
| | | | | | | | | | | | The global --help handler (also invoked when puppet is run without any other command line options at all) used to spit out a brief and generally not so helpful message. Now that we have a help face that can provide the same information in a much more user-friendly form, we should delegate the function to that when required. Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* maint: avoid making temporary dirs during testing.Daniel Pittman2011-04-121-13/+1
| | | | | | | | We used to create temporary directories to have some support files on disk during testing of faces; we don't really need that most of the time, and this updates a test to reflect that reality. Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* (#6962) Implement 'summary' for faces.Daniel Pittman2011-04-121-1/+1
| | | | | | | | | | | | This adds the methods to the summary builder and runtime instance to support setting and getting a summary of the face. This is a short description used to summarize the purpose of the face in help output. For example, from the help face: "Displays help about puppet subcommands" Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* Fixing 'puppet faces' applicationLuke Kanies2011-04-091-0/+6
| | | | | | | | | | | It only had one available method, and the errors incorrectly specified what it was. This just defaults to listing all the time, and I've updated the docs to be correct, too. Signed-off-by: Luke Kanies <luke@puppetlabs.com> Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
* maint: just require 'spec_helper', thanks rspec2Daniel Pittman2011-04-0816-16/+16
| | | | | | | | | | | rspec2 automatically sets a bunch of load-path stuff we were by hand, so we can just stop. As a side-effect we can now avoid a whole pile of stupid things to try and include the spec_helper.rb file... ...and then we can stop protecting spec_helper from evaluating twice, since we now require it with a consistent name. Yay. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
* maint: don't take over signal handling in tests...Daniel Pittman2011-04-081-0/+7
| | | | | | | | | We had a problem where we installed a signal handler during a :before block, which wasn't stubbed, so ended up leaving that in place forever. Which bites. We stub it out locally, which is ugly but functional. Paired-With: Matt Robinson <matt@puppetlabs.com>
* maint: Ruby < 1.8.7 knows size but not countMatt Robinson2011-04-081-4/+4
| | | | Reviewd-by: Nick Lewis
* maint: mark tests pending for a discovered bug...Daniel Pittman2011-04-081-0/+2
| | | | | | | Changes elsewhere in the tree break these two tests, but getting the merge in is worth marking them pending. :/ Paired-With: Nick Lewis <nick@puppetlabs.com>
* Merge puppet-interfaces into puppet.Daniel Pittman2011-04-076-0/+292
|\ | | | | | | | | This joins the two repositories, including full history, into a single run, as well as landing the interfaces work on the next branch ready for release.
| * (#7012) Update references in code to use face(s)Daniel Pittman2011-04-075-30/+27
| | | | | | | | | | The codebase is now using the new name, faces, uniformly to reference the objects contained. All tests pass.
| * (#7012) global rename of strings to faces.Daniel Pittman2011-04-072-0/+0
| | | | | | | | | | | | | | | | This just changes filenames and directories; files are exact copies rather than having additional modifications to make clearer each step of this process. This does leave a currently broken build. :/
| * (#6972) Handle ca-location in the certificate string.Daniel Pittman2011-04-061-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | This ports the existing certificate location configuration to be a string option, and then uses that to change the configuration. This will leak state between calls, which is somewhat unavoidable, but should at least get the basic stuff right for the CLI. We eventually need the CA string to be supported by a stateless internal CA implementation that allows us to do the right thing overall. Reviewed-By: Dan Bode <dan@puppetlabs.com>
| * (#6972) Recognize puppet global options in pre-parse.Daniel Pittman2011-04-061-0/+29
| | | | | | | | | | | | | | | | | | | | This extends the CLI pre-parse phase to identify both string *and* global options out of the Puppet settings/defaults system. This makes the regular CLI support for setting Puppet configuration globals work as expected. This moves us along the line of supporting these options more fully. Reviewed-By: Dan Bode <dan@puppetlabs.com>
| * (#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-041-1/+1
| | | | | | | | | | | | | | 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>
| * (#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-041-11/+19
| | | | | | | | | | | | | | 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-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-041-0/+0
| | | | | | | | | | | | | | | | 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-041-8/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | 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) implementing option handling in CLI string wrapperDaniel Pittman2011-04-041-12/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * (#6758) Pass options as an argument to string actions.Daniel Pittman2011-04-021-5/+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: 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 bracket notation instead of define in specsNick Lewis2011-03-291-0/+0
| | | | | | | | | | | | | | | | 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