summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application
Commit message (Collapse)AuthorAgeFilesLines
* (#7632) Make secret_agent application compatible with secret_agent facenfagerlund2011-06-061-19/+2
| | | | | | | | | | | | | | | Running `puppet secret_agent` was failing with an error in validate_args (in interface/action.rb), because the application was trying to pass the certname as an argument to the synchronize action. Also, it was trying to submit the report a second time. Reviewing the code with Nick0, we found that the application wasn't inheriting from FaceBase and was duplicating a lot of work, and were able to resolve the issue by basically deleting the whole thing. This patch makes secret_agent behave like the other Faces apps, and makes synchronize the default action of the secret_agent face. We left the `run_mode :agent` line in the application because of bug #7802. Paired-with: Nick Lewis <nick@puppetlabs.com>
* (#7683) Add a 'man' face and subcommand to Puppet.Daniel Pittman2011-06-011-0/+4
| | | | | | | | | | This is the minimal wrapper, cloning a good deal of the logic from help, that runs our face through the 'man' template and returns ronn-formatted Markdown. This provides the crudest baseline possible for getting man-style output, but lets us move forward to improve behaviour. Reviewed-By: Nick Fagerlund <nick.fagerlund@puppetlabs.com>
* maint: remove obsolete work-around code from help face.Daniel Pittman2011-06-011-3/+0
| | | | | | | | | | | | | The application wrapper for help used to disable the inherited 'render' method from FaceBase - specifically, to avoid the behaviour of rendering strings poorly. Now that we have support for good output in the upstream method, this is unnecessary, so we can eliminate the stub method entirely and use the default behaviour. (This also enables rendering the help into JSON or YAML, against the odds that someone actually cares about that. ;)
* #7211: nasty logic error with global Face options taking arguments.Daniel Pittman2011-05-311-1/+1
| | | | | | | | | | | | A logic error meant that global Face options that took arguments were mishandled: we never consumed the argument, so we read this: puppet facts --render-as json find $(hostname) ...as meaning "invoke the 'json' action on the 'facts' face"... This fixes that problem, so we now correctly handle both optional and non-optional arguments to global Face options.
* #7211: more helpful error messages in various cases.Daniel Pittman2011-05-311-6/+20
| | | | | | | | | | | | We were emitting a bunch of unhelpful failure messages, surrounding invalid actions and especially default actions interacting with the command-line. This cleans those up, to give a helpful, informative, and correct message in all cases. Notably, we no longer report that there is no "default" action when you specify an unknown action on a face. This change revealed some other weaknesses in our unit tests, now correctly, that result in slightly more robust code.
* (#7707) Document signals in puppet agent and puppet master helpnfagerlund2011-05-272-0/+22
| | | | | | | | | Previously, the signals accepted by the agent and master daemons were only documented in the configuration reference, which didn't make any particular sense. This commit moves their documentation to a blurb in the relevant man pages. This is a doc string only commit.
* (#7557) Remove Faces ApplicationMatt Robinson2011-05-261-122/+0
| | | | | | | | It used to be that to list the faces available and their actions and options, you had this legacy based face application. This functionality has all been moved into the puppet help face application. Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
* (#7690) Don't blow up when listing terminuses available for facesMatt Robinson2011-05-261-5/+1
| | | | | | | | | | | | | | | Previously, in order to list the available terminuses for an indirected face we loaded all the the terminuses in order to list them. This meant that if a terminus like active_record didn't have the dependencies it needed, the documentation would raise errors and not list terminuses. <Puppet::Error: Could not autoload filename uninitialized constant Object::ActiveRecord> Now we just list the terminuses available in the load path without trying to load them. The terminus will still raise an error if you try to use it without its dependencies being met. Paired-with: Max Martin <max@puppetlabs.com>
* maint: move trap call to Signal so we can stub it for specsMatt Robinson2011-05-191-1/+1
| | | | | | | | | | Also removed some monkey patching on Signal that would have theoretically done this without having to explicitly call trap on Signal in order to stub it, but it's not working. This allows us to ctrl+c (send SIGINT) in the middle of a spec run. Paired-with: Josh Cooper <josh@puppetlabs.com>
* (#7353) Remove :for_humans format entirely.Daniel Pittman2011-05-051-15/+5
| | | | | | | 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>
* Maint: adjust faces.rb's help to match that of other applicationsnfagerlund2011-05-041-6/+44
| | | | | | Faces isn't a face, interestingly, so it doesn't get a summary line in the puppet help. This will output the appropriately-formatted manpage text using the normal mechanism.
* (#7353) Unify rendering in the face_bace application.Daniel Pittman2011-05-041-44/+19
| | | | | | | | | | | 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>
* (#7276) Create a plugin face application.Daniel Pittman2011-05-031-0/+3
| | | | | | | | | | We need a boilerplate application file and class to expose a face on the command line; this adds that for the plugin face, to expose it to users. 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>
* maint: remove emacs 'coding' cookie from files.Daniel Pittman2011-05-031-1/+0
| | | | | | | | This is unnecessary, and only turned up because Matz &c. impose their taste on the rest of the world through the Emacs Ruby mode. Since people are starting to clone that, and it doesn't add value, eliminate it everywhere. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
* (#7317) better error handling in CLI face facade.Daniel Pittman2011-05-021-53/+46
| | | | | | | | | | | 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>
* Revert "maint: better error reporting for argument count mismatch."Daniel Pittman2011-04-281-39/+47
| | | | This reverts commit cd474b0aff0e0fec33295c8abc0668af90fb7cc1.
* maint: better error reporting for argument count mismatch.Daniel Pittman2011-04-281-47/+39
| | | | | Another face quirk in error reporting highlights a better way to work the error message; do so.
* (#7122) Enforce call arity on actions in the CLI wrapper.Daniel Pittman2011-04-281-1/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* (#7269) Fix error reporting for bad render formats...Daniel Pittman2011-04-281-24/+34
| | | | | | | | 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-10/+10
| | | | | | | | | | | | | | | | | 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-6/+9
| | | | | | | | | | | | 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>
* (#7157) Return a non-zero exit code on face failure.Daniel Pittman2011-04-221-12/+14
| | | | | | | | 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>
* (#7181) Rename configurer face to secret_agent.Daniel Pittman2011-04-211-2/+2
| | | | | | | | 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>
* (#7116) Handle application-level options in parse_optionsDaniel Pittman2011-04-201-0/+17
| | | | | | | | | | 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: fix gratuitous whitespace in the code.Daniel Pittman2011-04-201-2/+2
| | | | | | | We had some stray spacing between variables and the '=' sign from when there was another variable in place; it got deleted, but the code wasn't closed up. Reviewed-By: Max Martin <max@puppetlabs.com>
* Merge branch 'bug/2.7.x/6752-allow-action-specific-render-methods'Daniel Pittman2011-04-191-12/+45
|\ | | | | | | Fix the conflicts over changes in my previous commit.
| * (#7013) Wire up rendering hooks on the CLI.Daniel Pittman2011-04-191-1/+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-5/+7
| | | | | | | | | | | | | | | | | | | | | | 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-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: print 'false' in the default render method.Daniel Pittman2011-04-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | We used to skip printing if the return value from an action was false; this made it impossible to display "false" to the user, which was a more meaningful output in some cases than nothing. maint: print 'false' in the default render method. We used to skip printing if the return value from an action was false; this made it impossible to display "false" to the user, which was a more meaningful output in some cases than nothing. Reviewed-By: Max Martin <max@puppetlabs.com>
* | (#7108) Update help/man text for puppet kicknfagerlund2011-04-181-25/+10
|/ | | | | Puppet kick's help referred only to the outdated authconfig (namespaceauth.conf) file, rather than the modern rest_authconfig (auth.conf).
* Merge remote-tracking branch 'community/feature/puppet-device' into 2.7.xPieter van de Bruggen2011-04-181-0/+255
| | | | Reviewed-By: Mike Stahnke
* Merge branch 'tickets/2.7.x/7115' into 2.7.xPieter van de Bruggen2011-04-151-12/+20
|\
| * (#7115) Enable default actions.Pieter van de Bruggen2011-04-151-12/+20
| | | | | | | | | | | | | | This also enables the 'help' action on the 'help' face to serve as a default action. Reviewed-By: Daniel Pittman Reviewed-By: Nick Lewis
* | (#6408) Update puppet cert help for new subcommand action syntax.nfagerlund2011-04-141-47/+51
|/ | | | | Puppet cert now allows bareword actions, which brings it more in-line with the Faces subcommands. Updating the help text accordingly.
* Revert "(#6928) Removed --ignoreimport"Nick Lewis2011-04-133-10/+4
| | | | | | | This reverts commit 24a277c5e805ce16e0b86e17e6cb2fbe1945ae07. Despite not needing --ignoreimport as an option anymore, it's still used internally and has to stay.
* (#6928) Removed --ignoreimportNick Lewis2011-04-133-4/+10
| | | | | | This was only used with --parseonly, which is gone. Paired-With: Jesse Wolfe
* (#6928) Remove --parseonlyNick Lewis2011-04-132-30/+10
| | | | | | This has been removed in favor of 'puppet parser validate <manifest>'. Paired-With: Jesse Wolfe
* (#6928) Add a Parser face with Validate actionNick Lewis2011-04-131-0/+5
| | | | | | | This will accept a number of manifests as arguments and check their syntax. If no filenames are specified, it will check the default 'manifest' setting. Paired-With: Jesse Wolfe
* (#7056) Use 'face' rather than 'faces' in the production code.Daniel Pittman2011-04-136-18/+18
| | | | | | | | | 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-121-5/+13
| | | | | | | | | | | | 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) Override 'render' in help to just return the string.Daniel Pittman2011-04-121-3/+4
| | | | | | | The default behaviour is to serialize the result somehow, defaulting to displayed, render should be a no-op. This means overriding the parent method. Paired-With: Matt Robinson <matt@puppetlabs.com>
* (#6962) render prints the rval; fix help subcommand.Daniel Pittman2011-04-121-1/+1
| | | | | | | | | The face application base uses render to transform the returned object to a form where #to_s produces the output intended for the end user; we were actually printing in the method instead, leading to an extraneous 'nil' at the end of the output... Paired-With: Matt Robinson <matt@puppetlabs.com>
* (#6962) Create the basic shape of the help face.Daniel Pittman2011-04-121-0/+7
| | | | | | | | This implements the basic help face, along with the start of the support structures; we include the basic application, and the default help action that just emits a listing of faces and other discovered stuff... Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* maint: finish transition of application help to return strings.Daniel Pittman2011-04-121-2/+1
| | | | | | | | | | | | Jesse made a change, in e1191f33defcaffec5900c7122a89ca75d3a9673, to transition from printing and exiting in the help method up to returning the help data to the caller. This was part of eliminating rdoc usage from the display of help to the user. The cert application was missed, and still used the legacy "print and exit" model; this cleans that up so it matches the rest of the code. Paired-With: Matt Robinson <matt@puppetlabs.com>
* Fixed #5684 - Move to Apache 2.0 licenseJames Turnbull2011-04-1111-23/+11
| | | | | | | | | | | | | | For details of why we're moving please see: https://groups.google.com/d/topic/puppet-users/NuspYhMpE5o/discussion Removed explicit GPL licenses where appropriate Replaced selected GPL licenses with Apache 2.0 Replaced LICENSE with Apache 2.0 Updated README
* Fixing 'puppet faces' applicationLuke Kanies2011-04-091-16/+9
| | | | | | | | | | | 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>
* Merge puppet-interfaces into puppet.Daniel Pittman2011-04-0716-0/+334
|\ | | | | | | | | 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-28/+28
| | | | | | | | | | The codebase is now using the new name, faces, uniformly to reference the objects contained. All tests pass.