-
Notifications
You must be signed in to change notification settings - Fork 682
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
replace targets with fetcher+reader system #473
Conversation
cc01348
to
b5c31a0
Compare
# exits on execution: | ||
runner = Inspec::Runner.new(opts) | ||
profile = Inspec::Profile.for_target(detect_util, opts) | ||
runner.add_profile(profile) |
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.
I like that we pass a profile to runners now. We may discuss if we change the direction here as well, but not as part of this PR.
profile = Inspec::Profile.for_target(detect_util, opts)
profile.run
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.
Good point, also a curious one. The advantage of passing multiple things to runner is that it can add all things to a run and then execute them. If we have that execution, would we need Profile.run anymore? I guess it's still great for convenience...
1ce3aaa
to
e3e277e
Compare
This helps reduce any folder structures, weather on disk or in archives, to their relative root paths; i.e. ignore all file-prefixes that are given and go directly to the underlying files, relative to the common folders that contain it
instead of e.g. the rubygems location somewhere on the system
c52f206
to
1aad33a
Compare
@chris-rock LGTM. |
605cd31
to
105c587
Compare
105c587
to
605cd31
Compare
605cd31
to
01d7d5b
Compare
Awesome review, thank you @srenatus and @chris-rock ! |
replace targets with fetcher+reader system discussed with @arlimus, we're merging this although appveyor fails; to fix appveyor asap.
Fully removes the current target system, which typically worked this way:
Although incredibly convenient, this system was convoluted and hard to understand, as it did 2 things at once: Fetch the target you are interested in and then understand it (as either an InSpec profile or flat Ruby files, though there was some early support for Serverspec folders).
The new system instead works like this:
What appears to be more complex, now fully exposes all steps and clearly defines them. It provides explicit access to many elements of that chain, that were so far hidden, and led to a lot of code-duplication (e.g. source-paths, especially when chaining fetchers; relative-to-root vs absolute paths; raw contents instead of just converted ruby code).
Mainly targets bugs with InSpec's
json
andcheck
commands and anything that uses the profile class to work.