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

add mock support for os_env resource #2070

Merged
merged 1 commit into from
Aug 15, 2017
Merged

Conversation

chris-rock
Copy link
Contributor

This PR prevents issues when the os_env resource is called via inspec check. This issues appears now, since we doing the return handling right in train for mock requests inspec/train#187

/Users/chartmann/Development/compliance/inspec/lib/resources/os_env.rb:61:in `value_for': undefined local variable or method `os' for Environment variable DOCKER_CONTENT_TRUST:#<Class:0x007fd1a4cdd700> (NameError)
	from /Users/chartmann/Development/compliance/inspec/lib/resources/os_env.rb:29:in `initialize'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/plugins/resource.rb:47:in `initialize'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/resource.rb:47:in `new'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/resource.rb:47:in `block (3 levels) in create_dsl'
	from /Users/chartmann/Development/hardening/cis-docker-benchmark/controls/container_images.rb:111:in `block in load_with_context'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/rule.rb:49:in `instance_eval'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/rule.rb:49:in `initialize'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/control_eval_context.rb:71:in `new'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/control_eval_context.rb:71:in `block (2 levels) in create'
	from /Users/chartmann/Development/hardening/cis-docker-benchmark/controls/container_images.rb:99:in `load_with_context'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/profile_context.rb:146:in `instance_eval'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/profile_context.rb:146:in `load_with_context'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/profile_context.rb:130:in `load_control_file'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/profile.rb:151:in `block in collect_tests'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/profile.rb:148:in `each'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/profile.rb:148:in `collect_tests'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/profile.rb:454:in `load_checks_params'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/profile.rb:447:in `load_params'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/profile.rb:141:in `params'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/profile.rb:307:in `controls_count'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/profile.rb:278:in `check'
	from /Users/chartmann/Development/compliance/inspec/lib/inspec/cli.rb:69:in `check'
	from /Users/chartmann/.rvm/gems/ruby-2.3.3/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
	from /Users/chartmann/.rvm/gems/ruby-2.3.3/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
	from /Users/chartmann/.rvm/gems/ruby-2.3.3/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
	from /Users/chartmann/.rvm/gems/ruby-2.3.3/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
	from /Users/chartmann/Development/compliance/inspec/bin/inspec:12:in `<top (required)>'
	from /Users/chartmann/.rvm/gems/ruby-2.3.3/bin/inspec:22:in `load'
	from /Users/chartmann/.rvm/gems/ruby-2.3.3/bin/inspec:22:in `<main>'
	from /Users/chartmann/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `eval'
	from /Users/chartmann/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `<main>'

Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
@chris-rock chris-rock force-pushed the chris-rock/osenv-mock-support branch from e4ba28d to cc2e740 Compare August 14, 2017 21:46
@chris-rock chris-rock added the Type: Bug Feature not working as expected label Aug 14, 2017
@vjeffrey
Copy link

yes please! please! our travis tests are broken because of this bugger :(

Copy link
Contributor

@arlimus arlimus left a comment

Choose a reason for hiding this comment

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

Thank you for the quick mock!

@arlimus arlimus merged commit b1aba69 into master Aug 15, 2017
@arlimus arlimus deleted the chris-rock/osenv-mock-support branch August 15, 2017 03:37
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

3 participants