chef / chef-workstation

Chef Workstation gives you everything you need to get started with Chef, so you can automate how you audit, configure, and manage applications end environments.
Apache License 2.0
134 stars 112 forks source link

Inspec: uninitialized constant ActiveSupport #2508

Open niven01 opened 2 years ago

niven01 commented 2 years ago

Description

When attempting to run Inspec I receive the following error

Run inspec exec tests/basic/azure-inspec-tests --chef-license accept -t azure://
+---------------------------------------------+
✔ 1 product license accepted.
+---------------------------------------------+
/opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/activesupport-7.0.0/lib/active_support/xml_mini.rb:184:in `current_thread_backend': uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState (NameError)
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/activesupport-7.0.0/lib/active_support/xml_mini.rb:103:in `backend='
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/activesupport-7.0.0/lib/active_support/xml_mini.rb:201:in `<module:ActiveSupport>'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/activesupport-7.0.0/lib/active_support/xml_mini.rb:11:in `<top (required)>'
    from <internal:/opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
    from <internal:/opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/activesupport-7.0.0/lib/active_support/core_ext/hash/conversions.rb:3:in `<top (required)>'
    from <internal:/opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
    from <internal:/opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/activesupport-7.0.0/lib/active_support/core_ext/hash.rb:3:in `<top (required)>'
    from <internal:/opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
    from <internal:/opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/dsl_shared.rb:33:in `require'
    from libraries/backend/azure_require.rb:8:in `create'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/dsl_shared.rb:47:in `eval'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/dsl_shared.rb:47:in `require'
    from libraries/azure_backend.rb:1:in `create'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/dsl_shared.rb:47:in `eval'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/dsl_shared.rb:47:in `require'
    from libraries/azure_graph_generic_resource.rb:1:in `create'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/dsl_shared.rb:47:in `eval'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/dsl_shared.rb:47:in `require'
    from libraries/azure_active_directory_domain_service.rb:1:in `load_with_context'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/profile_context.rb:170:in `instance_eval'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/profile_context.rb:170:in `load_with_context'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/profile_context.rb:159:in `load_library_file'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/profile_context.rb:144:in `block in load_libraries'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/profile_context.rb:143:in `each'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/profile_context.rb:143:in `load_libraries'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/profile.rb:376:in `load_libraries'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/profile.rb:369:in `block in load_libraries'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/profile.rb:350:in `each'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/profile.rb:350:in `each_with_index'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/profile.rb:350:in `load_libraries'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/runner.rb:108:in `block in load'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/runner.rb:102:in `each'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/runner.rb:102:in `load'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/runner.rb:136:in `run'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/cli.rb:304:in `exec'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.52.9/lib/inspec/base_cli.rb:35:in `start'
    from /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-bin-4.52.9/bin/inspec:11:in `<top (required)>'
    from /usr/bin/inspec:380:in `load'
    from /usr/bin/inspec:380:in `<main>'
Error: Process completed with exit code 1.

This does work with versions

Chef Workstation version: 21.10.640
Chef InSpec version: 4.46.13

Chef Workstation Version

Chef Workstation version: 22.1.745
Chef InSpec version: 4.52.9

Platform Version

Ubuntu-20.04

vkarve-chef commented 2 years ago

Hi @niven01 could you please confirm if you are using the inspec-azure resource pack? If so, could you try version v1.86.0 or later? Additionally could you please share the profile that you are running?

niven01 commented 2 years ago

Hello @vkarve-chef

I am using the Inspec-Azure resource pack and grabbing the latest version each time. I pinned some testes to a specific version that worked and some were left to use the latest. On review it looks like they are also working now. Let me run some more tests but it may well be solved in version 1.86.x for me

name: azure-inspec-tests
title: Azure InSpec Profile
maintainer: Nielsen Pierce
license: Apache-2.0
summary: An InSpec Compliance Profile For Azure
version: 0.1.0
inspec_version: '>= 2.2.7'
depends:
- name: inspec-azure
  url: https://github.com/inspec/inspec-azure/archive/main.tar.gz
supports:
- platform: azure