| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This ensures that an option declaration that shadows itself is found, and
reported to the user, rather than silently eating one of the two.
This could have actually lost, for example, the distinction between an
argument-requiring and an argument-missing variant of the same thing.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When we wrote class inheritance of actions for strings we didn't implement
method (ahem, action) lookup correctly. This changes that, by providing the
implementation to our standards, along with appropriate tests.
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We want to support both strings and actions specifying options, to support
generic wrappers that present strings to the user across multiple distinct
front-ends.
At the moment we focus on implementation of a generic CLI providing full
control to all the strings, but we aim to support other programmatic
interfaces including Ruby and RPC invocation as part of the overall change.
We also detect, at the time they are declared, duplicate options. They are
reported, like any duplicate, with an error thrown. Specifically:
It is illegal to declare a duplicate option in the same scope, such as within
the same string, or within the same action. This is unchanged.
It is illegal to declare an option in an action that duplicates an option in
the string, or vice-versa. This is reported when the duplicate is declared,
so may report on either the string or action depending on sequence.
It remains legal to duplicate the same option across multiple actions, with
different meanings. There is no conflict, as the same option can't be passed
to both simultaneously.
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We had a series of tests that vary only on one input, and which wanted to
validate that the same failure happened after every instance; reducing this
to a set of input data lets us reduce code duplication in the tests.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We depend on require throwing about a specific file on disk, rather than just
generically, to ensure that we don't consume load errors from existing files.
This means our tests need to be updated to reflect that, by raising with
appropriate text when they stub require.
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Specifying a version of `:latest` will find the most recent version of the
named interface installed in your RUBYLIB, and attempt to load that. This is
unlikely to provide a stable dependency in the future, so should be used
sparingly, acknowledging the dangers.
Reviewed-By: Daniel Pittman
|
| | |
| | |
| | |
| | | |
Reviewed-By: Jacob Helwig
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
P::I#initialize now takes a name and a version (and an optional block). The
options hash has been removed, though it may be reintroduced if a legitimate
use case can be made for it (so far, it's only been used for the version
number).
Reviewed-By: Jacob Helwig
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We were returning 'true', which was getting printed
unnecessarily.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
At the moment the action method is a fairly heavy tool: it provides a DSL, and
is designed to allow substantial metadata to be added to the action.
For some users this is low on value, since they just want to write a little
script that drives things a bit differently. Which there is substantial value
in the metadata, adding the capability to do these light-weight things quickly
is valid.
To meet this we add a script action; the contrast is:
action :foo do
# other metadata goes here
invoke do |args|
# method body goes here
end
end
script :bar do |args|
# method body goes here
end
# ...and if you want metadata, you have to add it in more ugly, procedural
# ways, which we are not going to encourage.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
|
| | |
| | |
| | |
| | | |
Paired-With: Nick Lewis
|
| |\ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Conflicts:
lib/puppet/interface/certificate.rb
spec/unit/application/interface_base_spec.rb
spec/unit/interface/interface_collection_spec.rb
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Puppet::Interface::interface is now Puppet::Interface::define, also aliased to
Puppet::Interface::[] for convenience.
Paired-With: Nick Lewis
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
More information about the versioning scheme can be found at http://semver.org.
Paired-With: Nick Lewis
|
| | | |
| | | |
| | | |
| | | | |
Reviewed-By: Nick Lewis
|
| | | |
| | | |
| | | |
| | | | |
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
| | | | |
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The specs for InterfaceCollection were clearing the list of interfaces at the
end of the spec run, which caused later specs to fail because they couldn't
re-require interfaces they needed. This fixes the InterfaceCollection specs to
save and restore the interfaces at the end of the file.
Reviewed-By: Matt Robinson
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Having an instance variable on class Interface is insufficient for
Interface::Indirector. This also changes the semantics of "Interface.interface"
to handle registration and loading actions, and for "Interface.new" to only
instantiate an Interface. Thus, consumers of the API should typically use
"Interface.interface", unless they have reasons to not want an interface
automatically registered.
Paired-With: Pieter van de Bruggen
|
| |\ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Conflicts:
lib/puppet/interface/catalog.rb
lib/puppet/interface/catalog/select.rb
lib/puppet/interface/configurer.rb
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This class will represents an action, and allows us to store metadata for an
action, and programmatically introspect and invoke them. A helper class
ActionBuilder represents the DSL for defining an action.
Also defined an "invoke" DSL method to handle the functionality of defining the
method for an action.
Reviewed-By: Daniel Pittman
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Ruby's namespace mechanism introduced a number of problems, including
incorrect name resolution for common and simple cases. Given that,
we've refactored back to class-level data structures with accessor
methods available.
The current method names are unlikely to be the final UI.
Reviewed-By: Daniel Pittman
|
| | |
| | |
| | |
| | | |
Reviewed-By: Nick Lewis
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This application is similar in basic functionality to the "agent" application,
but implemented in terms of interfaces. It currently will retrieve facts,
retrieve a catalog, apply the catalog, and submit a report. Options such
as noop and daemonize are still to come.
Reviewed-By: Pieter van de Bruggen
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We didn't do enough input checking and sanitization, and missed some
edge-cases for naming interfaces. This adds testing, and cleans up some edge
cases to handle things better.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The initial merge of this branch hadn't actually been run against the full
suite of specs; a number of specs began failing shortly afterward.
Reviewed-By: Daniel Pittman
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Since constants are already being defined for each
interface, the #interface method does little but
provide another way to access the same data.
Reviewed-By: Nick Lewis
|
| | |
| | |
| | |
| | |
| | |
| | | |
We don't have json support for node output yet.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
I renamed it to 'info', too.
It only showed indirector-related info, so this
makes sense.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
| | |
| | |
| | |
| | | |
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
I had broken some usages of plugins by incorrectly
selecting command-line arguments. The fix was
to remove the #main method contained in the
IndirectionBase subclass.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|