summaryrefslogtreecommitdiffstats
path: root/spec
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | Revert "(#7220) Add the ability to "inherit" options."Daniel Pittman2011-05-122-121/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 9329a1f33b4d7df81ad8661de74f8a3656428570. Conflicts: spec/unit/interface/action_builder_spec.rb spec/unit/interface/action_spec.rb
* | | | | maint: sync 'authconfig' to 'rest_authconfig' settingDaniel Pittman2011-05-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We changed the name of the authconfig setting to specify 'rest_', but this branch merge didn't sync the change through all the tests. Now resolved by renaming the configuration option in the test also. Paired-With: Jacob Helwig <jacob@puppetlabs.com>
* | | | | Merge branch '2.7.x' into 2.7.nextDaniel Pittman2011-05-0664-655/+1199
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: * spec/unit/node/facts_spec.rb Updates: * spec/unit/interface/action{,_builder}_spec.rb => update for 'when_invoked' block being required.
| * | | | (#7353) Remove :for_humans format entirely.Daniel Pittman2011-05-052-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we never shipped this in a real release, we don't need to maintain compatibility. So, remove it entirely from the codebase. Reviewed-By: Max Martin <max@puppetlabs.com>
| * | | | Merge branch 'tickets/2.7.x/7179' into 2.7.xPieter van de Bruggen2011-05-041-12/+1
| |\ \ \ \
| | * | | | (#7179) Modify default ACL for /node/<name>.Pieter van de Bruggen2011-05-041-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, it is useful to permit an individual node to query information about itself, and there is no good reason to reject this by default. Paired-With: Nick Lewis
| * | | | | (#7353) Note the :for_humans compatibility issue.Daniel Pittman2011-05-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Where we need special support for :for_humans as an alias for :console, call it out in comments. This makes it clear to someone who wonders why what the actual underlying purpose of the whole thing is. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
| * | | | | (#7353) Unify rendering in the face_bace application.Daniel Pittman2011-05-041-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now move over to using only network FormatHandler rendering code for output, ditching all the support we had in the application. We include a compatibility shim to ensure that the :for_humans format that was supported for a while is now an alias for the :console format we are using moving forward. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
| * | | | | (#7353) Add 'console' format to FormatHandlerDaniel Pittman2011-05-041-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a console rendering format to the Network FormatHandler subsystem; it provides the same human-friendly textual rendering as the Faces application did, except it uses JSON rather than PP as the fall-back rendering mode. This paves the path for unification of all formatting into the same subsystem, rather than the half-measures we used to have. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
| * | | | | Merge branch ↵Daniel Pittman2011-05-031-1/+2
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | 'bug/2.7.x/7277-improve-secret-agent-face-and-supporting-actions' into 2.7.x
| | * | | | | (#7277)Fixing all secret-agent functions, and the agent itselfLuke Kanies2011-05-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This cleans up the behaviours and ensures that we have parity between the basic actions of the agent and the secret_agent. Reviewed-By: Daniel Pittman <daniel@puppetlabs.com> Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * | | | | | Merge branch 'ticket/2.7.x/7139' into 2.7.xNick Lewis2011-05-031-0/+7
| |\ \ \ \ \ \ | | |/ / / / / | |/| | | | |
| | * | | | | (#7139) Accept '/' as a valid path in filesetsNick Lewis2011-05-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was unconditionally removing the trailing file separator ('/'), which is only valid when the file separator isn't the entire path. This fixes 'puppet resource file <path>'. Paired-With: Jacob Helwig
| * | | | | | (#7329) Consistent naming for rendering formats and hooks.Daniel Pittman2011-05-032-0/+14
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We refer to rendering formats pretty consistently as `json`, `yaml`, `s`, and so forth; unqualified names. On the other hand, we refer to the rendering hooks *mostly* as `to_*`, except the `:for_humans` and `:json` formats. Which is kind of confusing because of the internal inconsistency, and because it doesn't match the public name. Fix the code to resolve both, so the `to_*` format still works, but we mostly expect to use the `*` version, to match public expectation.
| * | | | | (#7117) Return the environment as a Puppet::Node::Environment in uri2indirectionJacob Helwig2011-05-031-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The environment returned by uri2indirection used to be a Puppet::Node::Environment. When this changed to simply being the string of the environment name, this broke assumptions made in other areas of the code. Paired-with: Nick Lewis <nick@puppetlabs.com>
| * | | | | (#7276) Better reporting from the plugin download action.Daniel Pittman2011-05-031-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of just returning vague values, return useful information when rendering for a human being. Based on work by Luke Kaines <luke@puppetlabs.com> in https://github.com/lak/puppet/commit/a61cc770ca9b2cad744b5b21b9776a834d6ca895 Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | | | | (#7279) Adding some basic file actionsLuke Kanies2011-05-032-1/+12
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the ability to download a file into the local filebucket using a puppet URI or from disk. Also, the ability to store into the filebucket. These provide at least basic UI for moving data around using the filebucket service, and act as an example of how further work can be done. Also, update the code to eliminate a couple of redundant checks on arguments, and add some basic testing around the actions. Mostly only that they exist, at this point. Reviewed-By: Daniel Pittman <daniel@puppetlabs.com>
| * | | | Merge branch 'bug/2.7.x/7314-backtrace-when-face-has-syntax-error' into 2.7.xDaniel Pittman2011-05-024-13/+39
| |\ \ \ \
| | * | | | (#7314) Faces fail horribly when one has a syntax error.Daniel Pittman2011-05-022-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we hit a syntax error in any face, a whole bunch of unrelated face things would blow up in horrible ways. Stack traces for all... Now, instead, we catch that fault but specifically only in the face file and report it through our error logs, then quietly ignore the face. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| | * | | | maint: move the indirector face base out of puppet/faceDaniel Pittman2011-05-022-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to shove the base class Puppet::Face::Indirector next to the actual faces; this made a bunch of things, including testing, confusing. Instead, move it away into the indirector where it lives with the rest of the indirector related things. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| | * | | | maint: reset more global state in testing faces...Daniel Pittman2011-05-021-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we query for all faces we need to scan the entire Ruby load path, look for everything that looks like a face, and load it up. That is a fairly expensive operation, especially on a platform that has slow I/O. *cough* EC2 *cough* Because of that we only scan once, and assume that the list is static thereafter; this works OK out in the field, but sucks in testing where that global state gets in the way of the rest of our fiddling under the hood. This resets the '@loaded' member of the collection additionally, which is what should be done since we have reset the rest of the collection at the same time. We don't bother to reset it, as an extra scan during tests is not a problem. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| * | | | | Merge branch 'bug/2.7.x/7315-puppet-status-can't-render-as-json' into 2.7.xDaniel Pittman2011-05-021-0/+4
| |\ \ \ \ \
| | * | | | | (#7315) Fix `to_pson` method to render correctly.Daniel Pittman2011-05-021-0/+4
| | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Puppet::Status had an outdated implementation of the `to_pson` hook, so would fail to render when asked. Changes to the faces system exposed this, resulting in a backtrace if the user wanted JSON output on the CLI. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| * | | | | (#7304) Improve help from `puppet foo`Daniel Pittman2011-05-021-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This addresses two of the four points: we now quote the subcommand name, and emit 'Usage: ' before the usage information on the puppet command line. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| * | | | | (#7317) better error handling in CLI face facade.Daniel Pittman2011-05-021-2/+2
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The error handling code in the face CLI facade was pretty terrible: it make a bunch of assumptions about the structure of the error message it got back, and used exceptions to communicate inside the same function. Instead, we handle errors uniformly without raising and catching in the same method, report more nicely, and exit cleanly in all cases. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| * | | | Merge branch 'bug/2.7.x/7282-fail-when-no-invocation-given-for-action' into ↵Daniel Pittman2011-05-025-22/+71
| |\ \ \ \ | | |/ / / | |/| | | | | | | | 2.7.x
| | * | | (#7282) action without `when_invoked` should fail...Daniel Pittman2011-05-025-22/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to let actions be declared without the `when_invoked` block, which was usually a sign of either someone writing their method code direct in action declaration, or someone forgetting to add their code at all. This was just let silently by: the error only showed up when you finally tried to invoke the action, and a NoMethod error was raised by the face. ...except for our own testing. We took advantage of this a whole pile of times in there; fixing the original UI issue means fixing all those too. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| * | | | (Maint.) Fix accidental debug output in tests.Pieter van de Bruggen2011-04-291-1/+1
| |/ / / | | | | | | | | | | | | Reviewed-By: Daniel Pittman
| * | | Merge branch 'bug/2.7.x/7221-whitespace-stripping-for-documentation' into 2.7.xDaniel Pittman2011-04-291-14/+53
| |\ \ \
| | * | | (#7221) Strip bad whitespace from face and action docs.Daniel Pittman2011-04-291-14/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now strip whitespace in face (and related) documentation in two places: We strip any trailing whitespace on each line, just because. We strip any leading indent, but not all leading whitespace, from the text. That is, we strip the *minimum* amount of whitespace that we can take from every line in the documentation without changing the overall content. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | | | Merge branch 'tickets/2.7.x/7289' into 2.7.xPieter van de Bruggen2011-04-292-111/+181
| |\ \ \ \ | | |/ / / | |/| | |
| | * | | (#7289) Specify order for option decorations.Pieter van de Bruggen2011-04-292-111/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `before_action` decorations should always resolve in resolution order from most general (inherited from furthest away) to most specific (declared on the instance), and should always execute Face-level option decorations before action-level option decorations. `after_action` decorations should execute in the opposite order. Reviewed-By: Daniel Pittman
| * | | | (#7248) Fail if two aliases of one option are passed...Daniel Pittman2011-04-291-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the command line, and other facades, it is fairly difficult to call an action with two aliases of the same option in the invocation, but from the Ruby API it would be relatively easy to achieve. This is now checked, and raises an error, so that we don't accidentally have strange or unusual behaviour coming out of the whole system. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * | | | (#7122) Enforce call arity on actions in the CLI wrapper.Daniel Pittman2011-04-284-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had a problem, previously, in the generic translation of command line arguments to Ruby method calls: we could mistake the options, added by the CLI wrapper, for a positional argument to the action method. This was caused by a combination of factors, but primarily that the wrapper methods for actions are designed to present a friendly, helpful Ruby API for internal use. Consequently, they have a default value if you don't wish to pass options. Unfortunately, this meant that the options that the CLI *always* passed could be treated as a positional argument instead, and the default set of options added to the back of the call. To resolve this we now check the number of positional arguments in the CLI wrapper, and raise an exception if they are mismatched. This makes the generic CLI handling do the right thing in adapting the command line arguments to the Ruby API. (As an aside, we would have had a similar-but-different failure mode if we type-checked positional arguments: these calls would have failed with an invalid argument validation error.) Reviewed-By: Max Martin <max@puppetlabs.com>
| * | | | maint: add a 'print' matcher to rspec, to inspect std{out,err}Daniel Pittman2011-04-284-47/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | You can now write expectations along the lines of: expect { ... }.to print /whatever/ This will do the expected thing, which is to require that we print something matching that regular expression during the block. The output itself is suppressed during operation of the matcher. Paired-With: Max Martin <max@puppetlabs.com>
| * | | | (#7269) Fix error reporting for bad render formats...Daniel Pittman2011-04-281-57/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous change was incomplete, and could result in internal errors with the wrong combination of inputs. Now we have more testing, and a logically consistent model, so all works. Reviewed-By: Max Martin <max@puppetlabs.com>
| * | | | (#7269) Better error reporting for bad render formats.Daniel Pittman2011-04-281-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we would try and send `nil` to a class to render an unsupported format, which was bad. Worse, we would only discover this *after* the fact, when we tried to render, so the entire action had run and the result was lost to the world. Instead, validate the parameter early and fail during option parsing. This has less nice error reporting than we can get handling it later[1], but it gets us a much better overall set of behaviour. [1] puppet/application.rb will print and exit, rather than raising, when the option handler fails; this will improve when we unify face and application options properly. Reviewed-By: Max Martin <max@puppetlabs.com>
| * | | | (#7160) Support 'json' as a rendering method for CLI faces.Daniel Pittman2011-04-281-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already had some specialized support for rendering JSON using the PSON libraries; this just extends that to recognize the request on the command line for json to be identical to a request for pson. Theoretically we should also support the format in our network rendering code, but that is a much bigger change, in established code, that has more chance of destabilizing the whole release. Reviewed-By: Max Martin <max@puppetlabs.com>
| * | | | Merge branch 'feature/2.7.x/6962-finish-documentation-api-for-faces' into 2.7.xDaniel Pittman2011-04-278-27/+278
| |\ \ \ \ | | |/ / / | |/| | |
| | * | | (#6962) Add integration tests on Face documentation.Daniel Pittman2011-04-274-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now run all the faces, and their actions, as well as global help through the wringer in this test: this way we can be confident that we have, at least, the ability to generate the help without a user-visible failure. We also check that we have set copyright and license terms in our own faces. Theoretically this might fail if the end user has extra faces on LOAD_PATH, but my hope is that we won't hit that...
| | * | | (#6962) Finish documentation API on Face options.Daniel Pittman2011-04-272-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This extends the last of the documentation support, down into options, so they can be described as expected. In the process we split out the modular docs API into a full and short version options only want short docs, but the behaviours are identical to the full version.
| | * | | (#6962) Move documentation support into a module.Daniel Pittman2011-04-261-5/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given that we have identical documentation behaviour in the face and action code, it should properly be written once. So, move it into a module, extend the other classes with it, and have done.
| | * | | (#6962) Extend documentation API for Faces.Daniel Pittman2011-04-262-21/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the remaining documentation mechanisms to the Face instances, allowing them to build and report correct documentation, licensing and ownership for the help face to build on.
| * | | | (#7251) Let exceptions raised in decorators rise.Pieter van de Bruggen2011-04-261-2/+2
| |/ / / | | | | | | | | | | | | | | | | | | | | This allows users to write before_action advice that does basic option validation very easily. Reviewed-By: Daniel Pittman
| * | | maint: add the 'to', 'not_to', and 'to_not' aliases to rspec...Daniel Pittman2011-04-241-0/+12
| | | | | | | | | | | | | | | | | | | | Specifically, add them if they are not already added by rspec itself, which means that we can use them without blowing up older installations.
| * | | (#7157) Return a non-zero exit code on face failure.Daniel Pittman2011-04-222-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a face or action fails we should exit non-zero on the CLI to signal this to our caller. "Fails" is defined as "raises an exception"; we don't treat any return value as a significant failure. Reviewed-By: Jesse Wolf <jesse@puppetlabs.com>
| * | | maint: use the exit_with helper everywhere...Daniel Pittman2011-04-2218-190/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | maint: add an "exit was called" matcher for rspec.Daniel Pittman2011-04-221-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a bunch of places that want to test if exit was called in a block of code or not, which we did in a whole pile of ad-hoc ways. Instead, better to have a custom matcher that tests specifically for the correct exit exception being thrown, and the right error code in it. Reviewed-By: Jesse Wolf <jesse@puppetlabs.com>
| * | | maint: clean up test headers on face spec files.Daniel Pittman2011-04-2214-1/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A whole pile of spec files for faces were not pulling in the regular spec_helper, or the puppet/face library before they used it. This worked fine by coincidence when they ran together, but blew up if run separately. Reviewed-By: Jesse Wolf <jesse@puppetlabs.com>
| * | | Merge branch 'ticket/2.7.x/7080-reverts' into 2.7.xMax Martin2011-04-213-182/+6
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ticket/2.7.x/7080-reverts: Revert "Fixing Facts pson methods more resilient" Revert "(7080) Adding json support to Indirector Request" Revert "Adding json support to Puppet::Node"