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

Optimize InSpec detect #300

Closed
chris-rock opened this issue Dec 7, 2015 · 3 comments · Fixed by #720
Closed

Optimize InSpec detect #300

chris-rock opened this issue Dec 7, 2015 · 3 comments · Fixed by #720
Assignees
Labels
Type: Enhancement Improves an existing feature
Milestone

Comments

@chris-rock
Copy link
Contributor

We could enrich the inspec detect command with more valuable information. Currently we recieve the following output:

$ inspec detect
{"name":"mac_os_x","family":"darwin","release":"10.10.5","arch":null}

Especially the family does not reflect the power inspec offers with methods like os.linux? or os.redhat?. Therefore I propose to return an array for family. This returns all tags for an operating system like

{
    "name":"mac_os_x",
    "release":"10.10.5",
    "arch":null,
    "family":["darwin", "unix"]
}

{
    "name":"centos",
    "release":"7",
    "arch": "x86",
    "family":["linux", "unix", "redhat"]
}

We also should think about:

  • Users are confused by the json output that may return null.
  • We should have a json and human-readable output analog to the --format for exec (maybe even reuse those formatters), as highlight in a previous iteration of this issue by @arlimus

A human-readable output may look like

Operating System: Windows
Release:           2012 R2
Arch:                 X68
@chris-rock chris-rock added the Type: Enhancement Improves an existing feature label Dec 7, 2015
@chris-rock chris-rock added this to the 0.9.6 milestone Dec 7, 2015
@chris-rock chris-rock assigned chris-rock and unassigned srenatus Dec 7, 2015
@arlimus
Copy link
Contributor

arlimus commented Dec 7, 2015

all in all, love the idea!

Could we do:

inspec detect
... as suggested ...
inspec detect --format json
{ ... }

Moreover, this includes a sub-issue which must be treated as well: not returning null/nil.
For this case, a suggestion for output would be:

Operating system detection failed

and

{}

@arlimus
Copy link
Contributor

arlimus commented Dec 7, 2015

btw: this will break chef-compliance 😉 we'll need to update that too

@chris-rock chris-rock modified the milestones: 0.9.7, 0.9.6 Dec 11, 2015
@arlimus arlimus modified the milestones: 1.0.0, 0.9.7 Dec 14, 2015
@chris-rock chris-rock changed the title InSpec detect with JSON output Optimize InSpec detect Dec 31, 2015
@arlimus
Copy link
Contributor

arlimus commented Dec 31, 2015

Great update, cheers @chris-rock !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Improves an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants