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

bugfix: fix rare inspec shell missing all resources #582

Merged
merged 1 commit into from Mar 24, 2016

Conversation

alexpop
Copy link
Contributor

@alexpop alexpop commented Mar 24, 2016

In some instances, when running inspec shell, you don't get any resources inside of it. i.e. inspec shell and then os will lead to

NameError: undefined local variable or method `os' for
from (pry):1:in `add_content'

This is because of instance_eval loading withing the given source/line
information and not attaching to the profile context which actually has
all the resources. Fix it by making sure that inspec shell always
attaches to the profile context with resources by providing nil for
source and line information.

In some instances, when running inspec shell, you dont get any resources inside of it. i.e. `inspec shell` and then `os` will lead to

```ruby
NameError: undefined local variable or method `os' for
from (pry):1:in `add_content'
```

This is because of instance_eval loading withing the given source/line
information and not attaching to the profile context which actually has
all the resources. Fix it by making sure that inspec shell always
attaches to the profile context with resources by providing nil for
source and line information.
@arlimus arlimus force-pushed the ap/fix-inspec-shell-missing-resources branch from 768b724 to 3c3d711 Compare March 24, 2016 19:37
@arlimus
Copy link
Contributor

arlimus commented Mar 24, 2016

Awesom fix for a bug I couldn't even reproduce!

@aaronlippold @kdshah1 that takes care of the bug we saw 2 days ago 👍

@arlimus arlimus merged commit e7a2d9b into master Mar 24, 2016
@arlimus arlimus deleted the ap/fix-inspec-shell-missing-resources branch March 24, 2016 19:46
@kdshah1
Copy link

kdshah1 commented Mar 25, 2016

Awesome! Thank you all! Which version of inspec has the bug fix?

@arlimus
Copy link
Contributor

arlimus commented Mar 25, 2016

Give me a second to release it :)

@kdshah1
Copy link

kdshah1 commented Mar 25, 2016

no rush. Take your time.:-)

@arlimus
Copy link
Contributor

arlimus commented Mar 25, 2016

It is now available in the 0.16.4 release 🎊
https://rubygems.org/gems/inspec/versions/0.16.4

@kdshah1
Copy link

kdshah1 commented Mar 25, 2016

Thanks! will check it out soon.

@kdshah1
Copy link

kdshah1 commented Mar 25, 2016

inspec> auditd_rules
=> Audit Daemon Rules
inspec> auditd_rules.rules
=> {:syscalls=>[], :files=>[]}
inspec>

@kdshah1
Copy link

kdshah1 commented Mar 25, 2016

cool!

@arlimus
Copy link
Contributor

arlimus commented Mar 25, 2016

@kdshah1 awesome!! btw: try running it on a system which actually has auditd configured; if the rules cannot be read, let's tackle it in a separate issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants