| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
| | |
| | |
| | |
| | | |
Another face quirk in error reporting highlights a better way to work the
error message; do so.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
|\ \ \
| | | |
| | | |
| | | | |
Fix the conflicts over changes in my previous commit.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
|/ / /
| | |
| | |
| | |
| | | |
Puppet kick's help referred only to the outdated authconfig (namespaceauth.conf) file, rather than
the modern rest_authconfig (auth.conf).
|
| | |
| | |
| | |
| | | |
Reviewed-By: Mike Stahnke
|
|\ \ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This also enables the 'help' action on the 'help'
face to serve as a default action.
Reviewed-By: Daniel Pittman
Reviewed-By: Nick Lewis
|
|/ / /
| | |
| | |
| | |
| | | |
Puppet cert now allows bareword actions, which brings it more in-line with the
Faces subcommands. Updating the help text accordingly.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This reverts commit 24a277c5e805ce16e0b86e17e6cb2fbe1945ae07.
Despite not needing --ignoreimport as an option anymore, it's still used
internally and has to stay.
|
| | |
| | |
| | |
| | |
| | |
| | | |
This was only used with --parseonly, which is gone.
Paired-With: Jesse Wolfe
|
| | |
| | |
| | |
| | |
| | |
| | | |
This has been removed in favor of 'puppet parser validate <manifest>'.
Paired-With: Jesse Wolfe
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
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.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
The codebase is now using the new name, faces, uniformly to reference the
objects contained. All tests pass.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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. :/
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Now we are pushing into production we can eliminate this language, which was a
legacy from the prototype that is no longer relevant globally.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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>
|