From 7ec5d907d3657aeee2b4b58b21ee242251c0b813 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Sun, 10 Nov 2019 18:21:16 -0800 Subject: [PATCH 1/4] Various cookstyle fixes Autocorrect the cookbook with Cookstyle 5.11 Signed-off-by: Tim Smith --- files/default/handler/audit_report.rb | 2 +- files/default/vendor/chef-server/fetcher.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 From 292d487bd3f518d355ea59c7fbc969c9b11b3be0 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Sun, 5 Jan 2020 11:57:24 -0800 Subject: [PATCH 2/4] Switch to bionic in travis Signed-off-by: Tim Smith --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 93b257453bd406dbd5be9fc5ab5d6db7c8233baa Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Sun, 5 Jan 2020 11:57:51 -0800 Subject: [PATCH 3/4] Cookstyle fixes Signed-off-by: Tim Smith --- spec/unit/libraries/audit_enforcer_spec.rb | 4 ++-- spec/unit/recipes/default_spec.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) 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 From 76d0a38ba3856abcf8ffdf8c0e27af68d2e8c690 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Sun, 5 Jan 2020 11:58:02 -0800 Subject: [PATCH 4/4] Add github actions testing Signed-off-by: Tim Smith --- .github/workflows/delivery.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/delivery.yml 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