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

Merged
merged 3 commits into from Oct 26, 2016

Conversation

Projects
None yet
4 participants
@vjeffrey
Collaborator

vjeffrey commented Oct 25, 2016

fixes: #118

unsure about the disabled part, looking into that to confirm that works..

@binamov binamov added the in progress label Oct 25, 2016

@chris-rock

This comment has been minimized.

Collaborator

chris-rock commented Oct 25, 2016

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.

libraries/helper.rb Outdated
profiles.each { |profile|
if profile.include?(:supermarket_url)
profiles_array.push(profile[:supermarket_url] + "/" + profile[:name])

This comment has been minimized.

@chris-rock

chris-rock Oct 25, 2016

Collaborator

i think that will not work. we need to adapt the runner to give it more complex targets.

libraries/helper.rb Outdated
profiles.each { |profile|
if profile.length == 1 && profile[:name]
profiles_array.push("supermarket://" + profile[:name])

This comment has been minimized.

@chris-rock

chris-rock Oct 25, 2016

Collaborator

I think we want to give the runner the whole hash directly instead of transforming that to urls

This comment has been minimized.

@chris-rock

chris-rock Oct 25, 2016

Collaborator

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

@vjeffrey

This comment has been minimized.

Collaborator

vjeffrey commented Oct 26, 2016

tried to create test cookbook to include in examples folder for this, but having trouble.... Waiting for SSH service on 127.0.0.1:2200, retrying in 3 seconds i'll work on getting that in the morning...not sure what's happening there

read and parse profile targets
Signed-off-by: Victoria Jeffrey <vjeffrey@chef.io>
README.md Outdated
# filesystem path
"source" => "E:/profiles/win2012_audit"
"source": "E:/profiles/win2012_audit"

This comment has been minimized.

@chris-rock

chris-rock Oct 26, 2016

Collaborator

i think it needs to be path now

This comment has been minimized.

@vjeffrey

vjeffrey Oct 26, 2016

Collaborator

oh shoot, yes it does need to be path!

vjeffrey added some commits Oct 26, 2016

source -> path
Signed-off-by: Victoria Jeffrey <vjeffrey@chef.io>
test with profiles
Signed-off-by: Victoria Jeffrey <vjeffrey@chef.io>

@vjeffrey vjeffrey changed the title from wip: harmonize profile targets to harmonize profile targets Oct 26, 2016

@vjeffrey

This comment has been minimized.

Collaborator

vjeffrey commented Oct 26, 2016

@chris-rock: it's ready!

@vjeffrey vjeffrey changed the title from harmonize profile targets to harmonize profile targets Oct 26, 2016

@chris-rock

This comment has been minimized.

Collaborator

chris-rock commented Oct 26, 2016

Thanks @vjeffrey for this great improvement

@chris-rock chris-rock merged commit 7df3601 into master Oct 26, 2016

2 checks passed

DCO This commit has a DCO Signed-off-by
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@chris-rock chris-rock deleted the vj/harmonize-profile-targets branch Oct 26, 2016

@binamov binamov removed the in progress label Oct 26, 2016

@@ -2,3 +2,6 @@
source 'https://supermarket.chef.io'
metadata
cookbook 'apt'
cookbook 'yum'

This comment has been minimized.

@jeremymv2

jeremymv2 Oct 26, 2016

Contributor

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

https://github.com/chef-cookbooks/jenkins/blob/master/test/fixtures/cookbooks/jenkins_server_wrapper/recipes/default.rb#L3

This comment has been minimized.

@chris-rock

chris-rock Oct 26, 2016

Collaborator

Good call @jeremymv2, agree on that! @vjeffrey lets do that

This comment has been minimized.

@jeremymv2

jeremymv2 Oct 26, 2016

Contributor

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'

This comment has been minimized.

@jeremymv2

jeremymv2 Oct 26, 2016

Contributor

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.

This comment has been minimized.

@chris-rock

chris-rock Oct 26, 2016

Collaborator

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment