0

After upgrading Inspec from version 3.5.0 to 4.16.0, I've faced next issue:

    # 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)

The same issue I faced with Inspec 4.7.3

I've checked it on different platforms: MacOS, Centos7.

Could you please advice how can I solve this issue?

I can guess, that this parameter is getting from https://github.com/dev-sec/linux-baseline, which I use for inspec tests.

It worked in proper way with Inspec 3.5.0 version and it is working in proper way now with 3.5.0 version.

Regards, Ihor

  • you did not post your inspec code so it is hard to tell. please refer to the last line of your log and debug your program - `'method_missing': undefined local variable or method 'virtualization'` – Mr. Sep 16 '19 at 09:04
  • Hello @Mr! Looks like, that smth wrong linux-baseline. My code: docker = file('/.dockerenv').exist? vbox = file('/var/log/vboxadd-setup.log').exist? control 'local-timezone' do impact 1.0 title 'timezone' desc 'Check UTC' # Check timezone describe command('date') do its('stdout') { should match(/UTC/) } end end inspect.yml file name: base-inspec_profile title: Test maintainer: Ihor copyright: Ihor copyright_email: ihorkanivets@gmail.com version: 0.0.1 supports: - os-family: debian depends: - name: linux-baseline git: https://github.com/dev-sec/linux-baseline – Игорь Канивец Sep 16 '19 at 10:29
  • @Mr. I can find method virtualization in the https://github.com/dev-sec/linux-baseline inspec. It located in 3 control files: os_spec.rb, packages_spec.rb, sysctl_spec.rb. I've already checked uplading to new Chef-Automate server with inspec 4.16.0 version - the same issue. So it looks like, inspec https://github.com/dev-sec/linux-baseline somehow not compatible with inspec 4.16.0 version, because it works properly with Inspec 3.5.0. if additional information required from my side - let me please know. Thanks for helping. – Игорь Канивец Sep 16 '19 at 10:51
  • UPDATE: I've already checked it with linux-baseline guys https://github.com/dev-sec/linux-baseline/issues/122 it looks like, that it isn't their issue. Continue investigation. – Игорь Канивец Sep 16 '19 at 12:48
  • When I excluded linux-baseline it showed me next error: '/opt/inspec/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.16.0/lib/inspec/dsl.rb:47:in method_missing': undefined method file' for #<#:0x00007f913f89c218> (NoMethodError)' After I changing from: 'docker = file('/.dockerenv').exist?' to 'docker = File.file?('/.dockerenv')' I could upload profile to CA successfully, so I think, that it something changed in inspec and currently it doesn't work. I guess the same issue with "virtualization" error, because it also uses method. Regards, Ihor – Игорь Канивец Sep 17 '19 at 09:01

0 Answers0