将 Inspec 从 3.5.0 升级到 4.16.0 后,我遇到了下一个问题:
# inspec compliance upload linux-profile --overwrite
[2019-09-13T12:05:10+00:00] WARN: DEPRECATION: The 'default' option for attributes is being replaced by 'value' - please use it instead. attribute name: 'Inspec::Input'
Dependencies for profile linux-profile successfully vendored to /home/vagrant/inspec/linux-profile/vendor
I, [2019-09-13T12:05:11.051883 #2986] INFO -- : Checking profile in linux-profile
I, [2019-09-13T12:05:11.052093 #2986] INFO -- : Metadata OK.
[2019-09-13T12:05:11+00:00] WARN: DEPRECATION: The 'default' option for attributes is being replaced by 'value' - please use it instead. attribute name: 'Inspec::Input'
[2019-09-13T12:05:11+00:00] WARN: DEPRECATION: The 'default' option for attributes is being replaced by 'value' - please use it instead. attribute name: 'Inspec::Input' (used at /root/.inspec/cache/74df8a2d5a90a0a85d649450f2aaf36d06e91eb4/controls/os_spec.rb:20)
[2019-09-13T12:05:11+00:00] WARN: DEPRECATION: The 'default' option for attributes is being replaced by 'value' - please use it instead. attribute name: 'Inspec::Input' (used at /root/.inspec/cache/74df8a2d5a90a0a85d649450f2aaf36d06e91eb4/controls/os_spec.rb:22)
[2019-09-13T12:05:11+00:00] WARN: DEPRECATION: The 'default' option for attributes is being replaced by 'value' - please use it instead. attribute name: 'Inspec::Input' (used at /root/.inspec/cache/74df8a2d5a90a0a85d649450f2aaf36d06e91eb4/controls/os_spec.rb:23)
[2019-09-13T12:05:11+00:00] WARN: DEPRECATION: The 'default' option for attributes is being replaced by 'value' - please use it instead. attribute name: 'Inspec::Input' (used at /root/.inspec/cache/74df8a2d5a90a0a85d649450f2aaf36d06e91eb4/controls/os_spec.rb:24)
Traceback (most recent call last):
34: from /bin/inspec:186:in `<main>'
33: from /bin/inspec:186:in `load'
32: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-bin-4.16.0/bin/inspec:11:in `<top (required)>'
31: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/base_cli.rb:33:in `start'
30: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
29: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
28: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
27: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
26: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:238:in `block in subcommand'
25: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:115:in `invoke'
24: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
23: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
22: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
21: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb:161:in `upload'
20: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile.rb:421:in `check'
19: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile.rb:451:in `controls_count'
18: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile.rb:195:in `params'
17: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile.rb:597:in `load_params'
16: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile.rb:604:in `load_checks_params'
15: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile.rb:202:in `collect_tests'
14: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/dependencies/dependency_set.rb:63:in `each'
13: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/dependencies/dependency_set.rb:63:in `each'
12: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/dependencies/dependency_set.rb:64:in `block in each'
11: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile.rb:202:in `collect_tests'
10: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/dependencies/dependency_set.rb:63:in `each'
9: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/dependencies/dependency_set.rb:63:in `each'
8: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/dependencies/dependency_set.rb:64:in `block in each'
7: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile.rb:204:in `collect_tests'
6: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile.rb:204:in `each'
5: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile.rb:208:in `block in collect_tests'
4: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile_context.rb:145:in `load_control_file'
3: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile_context.rb:161:in `load_with_context'
2: from /opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/profile_context.rb:161:in `instance_eval'
1: from /root/.inspec/cache/74df8a2d5a90a0a85d649450f2aaf36d06e91eb4/controls/os_spec.rb:29:in `load_with_context'
/opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/dsl.rb:47:in `method_missing': undefined local variable or method `virtualization' for #<#<Class:0x00000000067e7e48>:0x00000000067e7538> (NameError)
我在 Inspec 4.7.3 中遇到的同样问题
我已经在不同的平台上检查过它:MacOS、Centos7。
你能建议我如何解决这个问题吗?
我可以猜到,这个参数来自https://github.com/dev-sec/linux-baseline,我用它来进行 inspec 测试。
它与 Inspec 3.5.0 版本一起正常工作,现在与 3.5.0 版本一起正常工作。
问候, 伊霍尔