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

Kali Linux platform detection support #556

Merged
merged 2 commits into from
Jan 27, 2020
Merged

Kali Linux platform detection support #556

merged 2 commits into from
Jan 27, 2020

Conversation

mattray
Copy link
Contributor

@mattray mattray commented Jan 16, 2020

Add support for detecting Kali Linux

Signed-off-by: Matt Ray github@mattray.dev

@mattray mattray requested a review from a team as a code owner January 16, 2020 10:59
@ghost ghost requested review from clintoncwolfe and miah January 16, 2020 10:59
@chef-expeditor
Copy link
Contributor

Hello mattray! Thanks for the pull request!

Here is what will happen next:

  1. Your PR will be reviewed by the maintainers.
  2. Possible Outcomes
    a. If everything looks good, one of them will approve it, and your PR will be merged.
    b. The maintainer may request follow-on work (e.g. code fix, linting, etc). We would encourage you to address this work in 2-3 business days to keep the conversation going and to get your contribution in sooner.
    c. Cases exist where a PR is neither aligned to Chef InSpec's product roadmap, or something the team can own or maintain long-term. In these cases, the maintainer will provide justification and close out the PR.

Thank you for contributing!

@mattray
Copy link
Contributor Author

mattray commented Jan 16, 2020

FWIW I installed Chef via the .DEB on the Kali box and ohai works just fine. They will both report the same platform, family and version after this.

Copy link
Contributor

@clintoncwolfe clintoncwolfe left a comment

Choose a reason for hiding this comment

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

This is looks OK to me.... one wonders if we should one day add a set of Kitchen platform detection tests or something.

@mattray
Copy link
Contributor Author

mattray commented Jan 17, 2020

Validated that this works with an aarch64 Kali install too

plat.name("kali").title("Kali Linux").in_family("debian")
.detect do
if linux_os_release && linux_os_release["ID"].eql?("kali")
@platform[:release] = linux_os_release["VERSION"]
Copy link
Contributor

Choose a reason for hiding this comment

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

This is 3 calls to linux_os_release... please use local variables to make it only 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in latest PR

@@ -76,6 +76,13 @@ def self.load
true
end
end
plat.name("kali").title("Kali Linux").in_family("debian")
.detect do
if linux_os_release && linux_os_release["ID"].eql?("kali")
Copy link
Contributor

Choose a reason for hiding this comment

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

eql? is never the right comparator to call and can't succeed in the wild. Please stick with ==.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in latest PR.

@@ -202,7 +216,7 @@ def debian_scan(id, version)

describe "/etc/os-release" do
describe "when not on a wrlinux build" do
it "fail back to genaric linux" do
it "fail back to generic linux" do
Copy link
Contributor

Choose a reason for hiding this comment

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

Hah! I just did this too.

Signed-off-by: Matt Ray <github@mattray.dev>
…eview

Followup on code review feedback

Signed-off-by: Matt Ray <github@mattray.dev>
@codeclimate
Copy link

codeclimate bot commented Jan 27, 2020

Code Climate has analyzed commit 4f36f12 and detected 4 issues on this pull request.

Here's the issue category breakdown:

Category Count
Style 4

View more on Code Climate.

@zenspider zenspider merged commit 21d6a84 into inspec:master Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants