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

Use target helpers in Inspec::Profile#from_file #413

Merged
merged 7 commits into from
Feb 4, 2016
Merged

Conversation

srenatus
Copy link
Contributor

@srenatus srenatus commented Feb 3, 2016

Before: Inspec::Profile was expecting a profile in a filesystem.
After: Inspec::Profile operates on the contents as returned from the target helper

Fixes #408.

@srenatus srenatus added the Type: Bug Feature not working as expected label Feb 3, 2016
@srenatus
Copy link
Contributor Author

srenatus commented Feb 3, 2016

Phew, so travis-ci has tar and zip.

current output:

    $ inspec check test/unit/mock/profiles/complete-profile.tgz
    I, [2016-02-03T10:22:21.377650 #13207]  INFO -- : Checking profile in test/unit/mock/profiles/complete-profile.tgz
    I, [2016-02-03T10:22:21.377745 #13207]  INFO -- : Found 1 rules.
    I, [2016-02-03T10:22:21.377771 #13207]  INFO -- : Rule definitions OK.
Note that this adds `ref: some/where/in/tarball/file` to the file
contents hash; it wasn't there before but it may be useful for error
reporting nonetheless.
# NB if you want to check more than one profile, use one
# Inspec::Profile#from_file per profile
m = metadata.first
@metadata = Metadata.from_ref(m[:ref], m[:content], @profile_id, @logger)
Copy link
Contributor

Choose a reason for hiding this comment

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

imho parse metadata beore adding/parsing tests; if anything fails with metadata, we don't jump into parsing tests

@srenatus srenatus changed the title use target helpers in Inspec::Profile#from_file WIP use target helpers in Inspec::Profile#from_file Feb 3, 2016
@chris-rock chris-rock changed the title WIP use target helpers in Inspec::Profile#from_file Use target helpers in Inspec::Profile#from_file Feb 3, 2016
@chris-rock
Copy link
Contributor

Thanks @renatus for this great fix

chris-rock added a commit that referenced this pull request Feb 4, 2016
Use target helpers in Inspec::Profile#from_file
@chris-rock chris-rock merged commit 9bda5de into master Feb 4, 2016
@chris-rock chris-rock deleted the sr/fix-408 branch February 4, 2016 07:53
@srenatus
Copy link
Contributor Author

srenatus commented Feb 4, 2016

Wait... that order... is... important? ❔ 😕 ❔

Thanks for catching that @chris-rock :)

@chris-rock
Copy link
Contributor

Needed this for #409 :-)

@chris-rock chris-rock added this to the 0.9.12 milestone Feb 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants