| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
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>
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
'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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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 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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| | |
Reviewed-By: Matt Robinson.
|
| |
| |
| |
| | |
Reviewed-By: Mike Stahnke
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|\ \
| | |
| | |
| | | |
'feature/2.7.x/6978-face-and-action-options-should-have-hooks-for-various-actions' into 2.7.x
|
| |/
| |
| |
| |
| |
| |
| |
| | |
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>
|
|/
|
|
|
|
|
| |
This also enables the 'help' action on the 'help'
face to serve as a default action.
Reviewed-By: Daniel Pittman
Reviewed-By: Nick Lewis
|
|
|
|
|
|
| |
This has been removed in favor of 'puppet parser validate <manifest>'.
Paired-With: Jesse Wolfe
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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 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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Reviewd-by: Nick Lewis
|
|
|
|
|
|
|
| |
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>
|
|\
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| | |
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 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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
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
|