You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While converting a cookbook from Serverspec to Inspec I found testing for a yum repo using yum.repo that does not exist causes Inspec to break.
InSpec and Platform Version
1.11.0 (ChefDK 1.2.22)
Replication Case
Using the original resource from my serverspec test:
File:
describe yumrepo('internal') do
it { should exist }
it { should be_enabled }
end
describe yumrepo('epel') do
it { should_not exist }
end
Output:
[DEPRECATION] `yumrepo(reponame)` is deprecated. Please use `yum.repo(reponame)` instead.
[DEPRECATION] `yumrepo(reponame)` is deprecated. Please use `yum.repo(reponame)` instead.
[DEPRECATION] `yumrepo(reponame)` is deprecated. Please use `yum.repo(reponame)` instead.
Target: docker://6f0853576e7fe411561c21959ea58963057ae63da3a7b539bda877bba8bd8933
Yum Repository
✔ should exist
✔ should be enabled
Yum Repository
✔ should not exist
Test Summary: 3 successful, 0 failures, 0 skipped
Using the new yum.repo('name') format.
File:
describe yum.repo('internal') do
it { should exist }
it { should be_enabled }
end
describe yum.repo('epel') do
it { should_not exist }
end
Output:
[root@localhost /]# inspec exec test.rb
/opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/resources/yum.rb:139:in `to_s': undefined method `[]' for nil:NilClass (NoMethodError)
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/metadata.rb:180:in `build_description_from'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/metadata.rb:133:in `populate'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/metadata.rb:258:in `create'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:420:in `set_it_up'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:384:in `subclass'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:258:in `block in define_example_group_method'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/inspec/runner_rspec.rb:27:in `example_group'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/inspec/runner.rb:238:in `get_check_example'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/inspec/runner.rb:264:in `block in register_rule'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/inspec/runner.rb:263:in `each'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/inspec/runner.rb:263:in `flat_map'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/inspec/runner.rb:263:in `register_rule'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/inspec/runner.rb:94:in `block in load'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/inspec/runner.rb:93:in `each'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/inspec/runner.rb:93:in `load'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/inspec/runner.rb:100:in `run'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/inspec/base_cli.rb:82:in `run_tests'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/inspec/cli.rb:158:in `exec'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/bin/inspec:12:in `<top (required)>'
from /usr/bin/inspec:22:in `load'
from /usr/bin/inspec:22:in `<main>'
Confirmed using the shell:
inspec> describe yumrepo('epel') do
inspec> it { should_not exist }
inspec> end
[DEPRECATION] `yumrepo(reponame)` is deprecated. Please use `yum.repo(reponame)` instead.
Profile: inspec-shell
Version: (not specified)
Yum Repository
✔ should not exist
Test Summary: 1 successful, 0 failures, 0 skipped
inspec> describe yum.repo('epel') do
inspec> it { should_not exist }
inspec> end
after_eval hook failed: NoMethodError: undefined method `[]' for nil:NilClass
/opt/inspec/embedded/lib/ruby/gems/2.3.0/gems/inspec-1.16.1/lib/resources/yum.rb:139:in `to_s'
(see _pry_.hooks.errors to debug)
The text was updated successfully, but these errors were encountered:
Description
While converting a cookbook from Serverspec to Inspec I found testing for a yum repo using
yum.repo
that does not exist causes Inspec to break.InSpec and Platform Version
1.11.0 (ChefDK 1.2.22)
Replication Case
Using the original resource from my serverspec test:
File:
Output:
Using the new
yum.repo('name')
format.File:
Output:
Confirmed using the shell:
The text was updated successfully, but these errors were encountered: