-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standard module options #1131
Standard module options #1131
Conversation
779a1a8
to
7555154
Compare
Overall, I really like it. However, I'm also really concerned about there being garbage in folks repository definitions. I haven't looked far enough into it to know if that concern is valid though. |
7555154
to
9bbcd5f
Compare
@binford2k can you take a look at this and @justinstoller's comment, let me know what you think? For now I'll whip up a commit permitting and warning on garbage parameters. |
@reidmv is there a pressing reason to disallow garbage parameters? Warn/permit seems like a reasonable non-breaking solution, with the expectation that next major release would make it invalid. |
@binford2k @justinstoller I've added some commits that permit R10K::Util::Setopts to warn on unhandled options instead of raising, and R10K::Environment::Git now makes use of that. It looks to me like that was the only object, actually, that wasn't already validating input options somehow. In any case though, it's now possible to permit unhandled options when necessary to preserve behavior. |
yes, this should also include a changelog update (and add one for the other PR while you're at it, please 😊 ). I was planning to review this eventually, but don't wait on me if you think it's already received sufficient review. |
9e90783
to
606cbd5
Compare
New commit pushed with additional docs updates, changelog additions |
Anything you wanna squash @reidmv ? I take it this probably shouldn't all be a single commit, but there are pieces that could be squashed. |
Yeah, lemme clean it up a bit. Just a moment. |
Let setopts explicity ignore some arguments, and give it the ability to warn on options that don't match the schema, instead of raising. This is to enable using setopts in places where we need to preserve backwards compatibility with a less clearly defined, more permissive interface.
029560c
to
d873f13
Compare
Rebased into something resembling a clean history. There is one final cleanup change mixed in here as well. It relates to how |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if you wanted to squash in the various pieces of that last improvements commit, but otherwise looks good!
@justinstoller did you want to take another look?
Allow modules of any currently supported type to be initialized using the following standard specification: --- <module-name>: type: <type> source: <source> version: <version> This is in slight contrast to today's expectations, which are largely based on the presence of a type-specific key to indicate the kind of module to create, and there are no standard parameters to indicate source and version. By providing a standard schema for defining modules of any type, this paves the way for easier integration with external data systems which may define sets of modules of many types to include in different environments. This schema is generalized away from implementation and towards the concepts that matter to the user.
And make it obvious which options are part of the standard interface. Clean up :puppetfile_name handling The pattern appears to be, call super first. The base class initialize method saves off the original, unmodified options to @Args. Base classes then delete options they process. The outer class uses setopts to process the remainder.
Add standard interface updates to docs, changelog Co-authored-by: Molly Waggett <mwaggett@alumni.reed.edu>
d873f13
to
a70e301
Compare
Alright, totally squashed, ended with four total commits: 1 for setopts enhancements, 1 for module interface additions, 1 for environment interface additions, and a separate commit for docs updates. |
The PR puppetlabs#1131 changed the order of method calls in the Forge initialization; that ended up breaking scenarios where the opts was not a Hash and the else branch in the logic called `current_version`, which needs the @metadata object defined before it can be successfully called. This change just simply restores the previous ordering.
The PR puppetlabs#1131 changed the order of method calls in the Forge initialization; that ended up breaking scenarios where the opts was not a Hash and the else branch in the logic called `current_version`, which needs the @metadata object defined before it can be successfully called. This change moves that instantiation up to happen before that `current_version` could be called.
The PR puppetlabs#1131 changed the order of method calls in the Forge initialization; that ended up breaking scenarios where the opts was not a Hash and the else branch in the logic called `current_version`, which needs the @metadata object defined before it can be successfully called. This change moves that instantiation up to happen before that `current_version` could be called.
The PR puppetlabs#1131 changed the order of method calls in the Forge initialization; that ended up breaking scenarios where the opts was not a Hash and the else branch in the logic called `current_version`, which needs the @metadata object defined before it can be successfully called. This change moves that instantiation up to happen before that `current_version` could be called.
The PR puppetlabs#1131 changed the order of method calls in the Forge initialization; that ended up breaking scenarios where the opts was not a Hash and the else branch in the logic called `current_version`, which needs the @metadata object defined before it can be successfully called. This change moves that instantiation up to happen before that `current_version` could be called.
This PR is primarily designed to sanitize the schema used by the Hash source type to define environments and modules, adopting a standard way of describing content (environments, modules) which is not implementation-dependent, the way today's modules especially are.
The idea is that when specifying content in a data hash, it should be possible to specify it using these standard keys.
This PR assumes #1130 exists to improve the visibility of what happens if users use conflicting ways of specifying values like version, such as by using both
version
and an implementation-specific key likegit
, but does not depend on that improvement.This PR homogenizes how options are parsed for many objects by standardizing on the use of
R10K::Util::Setopts
.See the rich diff of the doc/dynamic-environments/configuration.mkd page for the best visual of what this change accomplishes for consumers.
This improvement takes a UX step in the direction of r10k being able to support other types of environment sources and module sources, such as e.g. tarballs from Artifactory or S3.
This PR should be backwards compatible, without behavior changes, with one exception. Some object types did not validate schema in any way for keys passed into them.
R10K::Util::Setopts
does validate schema, and so garbage keys that would have been ignored previously may now cause an error.