-
Notifications
You must be signed in to change notification settings - Fork 59
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
harmonize profile targets #121
Conversation
054e28c
to
859e1f5
Compare
Lets remove the disabled part, not sure why we introduced that in the first place. You can just remove the block for the profile location if you do not want to execute it. If I remember correctly that was intended to load profiles but do not report them. We do not need that anymore, since we will rely on InSpec core to handle that. |
|
||
profiles.each { |profile| | ||
if profile.include?(:supermarket_url) | ||
profiles_array.push(profile[:supermarket_url] + "/" + profile[:name]) |
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 think that will not work. we need to adapt the runner to give it more complex targets.
|
||
profiles.each { |profile| | ||
if profile.length == 1 && profile[:name] | ||
profiles_array.push("supermarket://" + profile[:name]) |
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 think we want to give the runner the whole hash directly instead of transforming that to urls
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.
we would need to adapt the add_target
method in inspec: https://github.com/chef/inspec/blob/master/lib/inspec/runner.rb#L156-L164 to receive objects. By default it is using that function to change from url string to hash object: https://github.com/chef/inspec/blob/master/lib/inspec/profile.rb#L43-L46.
Instead we would invoke https://github.com/chef/inspec/blob/master/lib/inspec/profile.rb#L38-L41 from the runner initially. See how it is invoked at https://github.com/chef/inspec/blob/master/lib/inspec/dependencies/requirement.rb#L101-L106
3a39fdc
to
78284c3
Compare
tried to create test cookbook to include in examples folder for this, but having trouble.... |
Signed-off-by: Victoria Jeffrey <[email protected]>
78284c3
to
607db37
Compare
# filesystem path | ||
"source" => "E:/profiles/win2012_audit" | ||
"source": "E:/profiles/win2012_audit" |
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 think it needs to be path
now
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.
oh shoot, yes it does need to be path!
Signed-off-by: Victoria Jeffrey <[email protected]>
cbf8300
to
f7c2354
Compare
Signed-off-by: Victoria Jeffrey <[email protected]>
9a9ff41
to
6a166f4
Compare
@chris-rock: it's ready! |
Thanks @vjeffrey for this great improvement |
@@ -2,3 +2,6 @@ | |||
source 'https://supermarket.chef.io' | |||
|
|||
metadata | |||
|
|||
cookbook 'apt' | |||
cookbook 'yum' |
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.
It looks like the 'git' client is just going to be used during testing/validation. In that case, the better pattern is to use a fixture cookbook to install git rather than a 'prep' recipe. See this example of installing 'java' for testing the 'jenkins' cookbook:
https://github.com/chef-cookbooks/jenkins/blob/master/Berksfile#L9-L21
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 call @jeremymv2, agree on that! @vjeffrey lets do that
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.
A simple/safe way of installing the git binary on linux is via the git cookbook:
https://github.com/chef-cookbooks/git/blob/master/recipes/default.rb
@@ -0,0 +1,2 @@ | |||
# this is required to run git dependencies via inspec | |||
package 'git' |
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.
This recipe seems out of place if only for the purpose of being used during the testing phase in kitchen of this cookbook. In my opinion, a better approach is to install it via a fixture cookbook.
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.
👍
fixes: #118
unsure about the disabled part, looking into that to confirm that works..