Skip to content
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

implement chef-server fetcher and reporter #135

Merged
merged 1 commit into from
Nov 1, 2016

Conversation

chris-rock
Copy link
Contributor

This PR implements #129

# TODO: should be available in inspec `json-min` reports out-of-the-box
# TODO: raise warning when not a compliance-known profile
def cc_profile_index(profiles)
cc_profiles = tests_for_runner(profiles).map { |profile| profile[:compliance] if profile[:compliance] }.uniq.compact
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be tests_for_runner(profiles).select { |profile| profile[:compliance] }.uniq.compact:

irb(main):001:0> ls = [ { foo: nil }, { bar: 3 }, { foo: 4 }]
=> [{:foo=>nil}, {:bar=>3}, {:foo=>4}]
irb(main):002:0> ls.select {|x| x[:foo] }
=> [{:foo=>4}]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case we would need:

tests_for_runner(profiles).select { |profile| profile[:compliance] }.map { |profile| profile[:compliance].uniq.compact

I think it reads better, although we loop more often. Thanks @srenatus

@@ -5,7 +5,7 @@
license 'Apache 2.0'
description 'Allows for fetching and executing compliance profiles, and reporting its results'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '2.0.0'
version '2.0.2'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not change the version in this PR

@chris-rock chris-rock force-pushed the chris-rock/chef-server branch 2 times, most recently from f17e426 to caaff08 Compare November 1, 2016 16:29
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
@chris-rock chris-rock force-pushed the chris-rock/chef-server branch from caaff08 to 9ee6d0f Compare November 1, 2016 16:44
@vjeffrey
Copy link

vjeffrey commented Nov 1, 2016

👍 on the code, testing against viz -- have to reboot real quick cause everything is hanging

profile_id: profile_id,
}
}
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would prob be cool to have a test on this method someday... :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, it could be moved to helper.rb

@vjeffrey
Copy link

vjeffrey commented Nov 1, 2016

tested against viz -- all good 👍

@chris-rock chris-rock merged commit f5a8ca9 into master Nov 1, 2016
@chris-rock chris-rock deleted the chris-rock/chef-server branch November 1, 2016 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants