diff --git a/.github/workflows/delivery.yml b/.github/workflows/delivery.yml new file mode 100644 index 00000000..4b5c4676 --- /dev/null +++ b/.github/workflows/delivery.yml @@ -0,0 +1,16 @@ +name: delivery + +on: [push, pull_request] + +jobs: + delivery: + + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@master + - name: Run Chef Delivery + uses: actionshub/chef-delivery@master + env: + CHEF_LICENSE: accept-no-persist \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 6dee27de..6d3ddf8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ -dist: xenial +dist: bionic addons: apt: sources: - - chef-current-xenial + - chef-current-bionic packages: - chefdk diff --git a/files/default/handler/audit_report.rb b/files/default/handler/audit_report.rb index 7338363e..4c72e2eb 100644 --- a/files/default/handler/audit_report.rb +++ b/files/default/handler/audit_report.rb @@ -61,7 +61,7 @@ def report # detect if we run in a chef client with chef server load_chef_fetcher if reporters.include?('chef-server') || reporters.include?('chef-server-automate') || - %w{chef-server chef-server-automate}.include?(fetcher) + %w(chef-server chef-server-automate).include?(fetcher) load_automate_fetcher if fetcher == 'chef-automate' diff --git a/files/default/vendor/chef-server/fetcher.rb b/files/default/vendor/chef-server/fetcher.rb index 7186d786..287dda0a 100644 --- a/files/default/vendor/chef-server/fetcher.rb +++ b/files/default/vendor/chef-server/fetcher.rb @@ -125,7 +125,7 @@ def self.chef_server_reporter? def self.chef_server_fetcher? # TODO: harmonize with audit_report.rb load_chef_fetcher - %w{chef-server chef-server-compliance chef-server-visibility chef-server-automate}.include?(Chef.node.attributes['audit']['fetcher']) + %w(chef-server chef-server-compliance chef-server-visibility chef-server-automate).include?(Chef.node.attributes['audit']['fetcher']) end private diff --git a/spec/unit/libraries/audit_enforcer_spec.rb b/spec/unit/libraries/audit_enforcer_spec.rb index 40db3586..347a12f7 100644 --- a/spec/unit/libraries/audit_enforcer_spec.rb +++ b/spec/unit/libraries/audit_enforcer_spec.rb @@ -39,11 +39,11 @@ end it 'is not raising error for an InSpec report with no controls' do - expect(@automate.send_report({ "profiles": [{ "name": 'empty' }] })).to eq(true) + expect(@automate.send_report("profiles": [{ "name": 'empty' }])).to eq(true) end it 'is not raising error for an InSpec report with controls but no results' do - expect(@automate.send_report({ "profiles": [{ "controls": [{ "id": 'empty' }] }] })).to eq(true) + expect(@automate.send_report("profiles": [{ "controls": [{ "id": 'empty' }] }])).to eq(true) end it 'raises an error for a failed InSpec report' do diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb index 648bb01d..94e4c558 100644 --- a/spec/unit/recipes/default_spec.rb +++ b/spec/unit/recipes/default_spec.rb @@ -183,10 +183,10 @@ runner.converge(described_recipe) end it 'still contains the audit attributes after converge' do - expect(chef_run.node.attributes['audit']['attributes']).to eq({ 'my-inspec-attribute' => 'ok' }) + expect(chef_run.node.attributes['audit']['attributes']).to eq('my-inspec-attribute' => 'ok') end it 'should contain the inspec attributes in the run_state' do - expect(chef_run.node.run_state['audit_attributes']).to eq({ 'my-inspec-attribute' => 'ok' }) + expect(chef_run.node.run_state['audit_attributes']).to eq('my-inspec-attribute' => 'ok') end it 'should not raise an exception' do expect { chef_run }.to_not raise_error @@ -204,7 +204,7 @@ expect(chef_run.node.attributes['audit']['attributes']).to eq(nil) end it 'should contain the inspec attributes in the run_state' do - expect(chef_run.node.run_state['audit_attributes']).to eq({ 'my-inspec-attribute' => 'ok' }) + expect(chef_run.node.run_state['audit_attributes']).to eq('my-inspec-attribute' => 'ok') end it 'should not raise an exception' do expect { chef_run }.to_not raise_error