| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
As part of moving to load actions first, and their associated face, when
invoked from the command line, it makes sense to push the logic for finding
the action and face down into the Puppet::Face implementation.
This means that we can change the logic there without needing to update the
public part of the CLI implementation, and that any further facades can use
the same, correct, logic to locate the action for the face.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
|
|
|
|
|
|
|
|
|
|
| |
This introduces a class representing a semantic version, and
implementing a few of the most common uses of them: validation,
comparison, and finding the greatest available version matching
a range. This refactoring also allows us to easily expand our
matching of version ranges in the future, which is a big plus.
Reviewed-By: Daniel Pittman
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We accidentally omitted whitespace between multiple options while building the
synopsis. This fixes that, by introducing a breakable space in the right
location.
Additionally, we extract the code that was 99 percent identical from the face
and action synopsis generators, push it down into the documentation module,
and then invoke it from both places.
This eliminates the duplicate code, allowing me to fix that bug once and have
it apply to both parts of the code; this is pretty much assured to be true
any time we change the synopsis generation.
Reviewed-By: Nick Fagerlund <nick.fagerlund@puppetlabs.com>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`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
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
| |
This allows users to write before_action advice that does basic
option validation very easily.
Reviewed-By: Daniel Pittman
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
"Invisible glob", or "prefix", version matching means that when you specify a
version string to use you can specify as little as one version number out of
the semantic versioning spec.
Matching is done on the prefix; an omitted number is treated as "anything" in
that slot, and we return the highest matching versioned face by that spec.
For example, given the set of versions: 1.0.0, 1.0.1, 1.1.0, 1.1.1, 2.0.0
The following would be matched:
input matched
1 1.1.1
1.0 1.0.1
1.0.1 1.0.1
1.0.2 fail - no match
1.1 1.1.1
1.1.1 1.1.1
1.2 fail - no match
|
|
|
|
|
|
|
|
|
|
| |
We would report this:
Could not find version 1.0.0 of Puppet::Face[:version_matching, "2.0.0"]
That is not actually so helpful, not least because people wonder why it
reports a version number they didn't ask for. Instead, we just report the
requested name now.
|
|\
| |
| |
| | |
Fix the conflicts over changes in my previous commit.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
These define the API used by folks writing actions that supports their
rendering hooks. 'when_rendering' defines a helper method on the interface,
which runs the users code in their expected context.
'render_as' just sets the default rendering format; by default this is
:for_humans.
Reviewed-By: Max Martin <max@puppetlabs.com>
|
| |
| |
| |
| |
| |
| |
| | |
Right now we have no other support for multi-version loading in the code; we
should strip out support from the action loading to mirror.
Reviewed-By: Max Martin <max@puppetlabs.com>
|
| |
| |
| |
| |
| |
| |
| | |
This adds the 'description' method to the faces and actions, as well as
structured testing to ensure that the DSL works as expected.
Reviewed-By: Max Martin <max@puppetlabs.com>
|
|/
|
|
|
|
|
|
|
| |
Our summary documentation is used to provide single-line context to faces,
actions, and other items. To support this we hard-fail if someone tries to
use the summary to embed the long documentation, and point them to the right
place to add the extended text.
Reviewed-By: Max Martin <max@puppetlabs.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Options can now add before_action and after_action blocks; these are invoked
before or after any action is invoked on the face. This allows these options
to declare common behaviour and have it automatically applied to the actions
invoked.
Option hooks have no defined order of invocation: they will run in a
completely random order. Where there are dependencies they should be on the
value of the options hash passed to the invocation, not on side-effects of the
other invocations.
You are not able to influence the arguments, options, or calling of the action
body in a before or after decorator. This is by design.
The invocation passes to the hook:
1. The action object representing this action.
2. The arguments to the action, as an array.
3. The options for the action, as a hash.
Paired-With: Max Martin <max@puppetlabs.com>
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch does two things:
1. splits out the string lookup functionality from define into a seperate
method []
2. Tries to both load the specific version of a string as well as the
current version so that specific error messages can be returned
differentiating between an invalid version/string.
Reviewed-By: Daniel Pittman <daniel@puppetlabs.com>
|
|
|
|
|
|
|
|
|
| |
This splits out the plumbing into the Puppet::Interface namespace, and uses
Puppet::Faces for all the public-facing code.
The fault line is "what you care about if you are using or writing a face",
which is public, against "what you care about to enable either of those two",
which is the plumbing.
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
Puppet::Interface::interface is now Puppet::Interface::define, also aliased to
Puppet::Interface::[] for convenience.
Paired-With: Nick Lewis
|
|
|
|
| |
Reviewed-By: Nick Lewis
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows all of the actions to react to the CLI
options.
I've also removed the unnecessary 'name' variables I
was using in various places - they were just the first
of the arguments, and they weren't actually always
names.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
|
|
|
|
|
|
| |
Also added a test to hopefully confirm it won't
break again.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
|
|
|
| |
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
|
|
|
|
|
|
|
|
| |
They were previously classes, which made a lot of things stupider
than they needed to be.
This will likely involve some porting, but not much.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
|
|
|
|
|
| |
It got broke when the Indirector base class was extracted.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
|
|
|
|
|
|
|
|
|
|
| |
The initial work assumed that all interfaces were just
skins on an indirected data type, but some interfaces will
be more abstract than that.
This commit removes that assumption by extracting all of
the indirector work into a new Indirector subclass of
Interface and then makes all of the new interfaces a subclass
of that rather than of Interface itself.
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the app, indirection, and interface names
had to match exactly; now they can be arbitrary by
just defining an overriding 'indirection_name' class
method on the interface.
I also renamed the file_bucket_file classes accordingly.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
|
|
|
| |
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
|
|
|
|
|
| |
This allows easier use of the Interfaces in ruby.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
|
|
|
|
|
|
| |
The whole system seems to work again, as long as
you run it against 2.6.next.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|
|
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|