From 0a96810faa7adc11933bec6e223c1c60dc1627c3 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Wed, 2 Oct 2024 12:02:02 -0500 Subject: [PATCH 1/6] Deprecate backend resource Signed-off-by: Corey Hemminger --- .github/workflows/ci.yml | 43 ++-------------------------------------- CHANGELOG.md | 4 ++++ kitchen.dokken.yml | 12 +++++------ metadata.rb | 2 +- resources/automatev2.rb | 1 - resources/backend.rb | 2 ++ 6 files changed, 15 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb3be0f..4edff28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,10 +22,10 @@ jobs: - centos-7 - centos-8 - almalinux-8 -# - almalinux-9 # TODO: uncomment this when almalinux-9 dokken image is fixed - - ubuntu-1804 + - almalinux-9 - ubuntu-2004 - ubuntu-2204 + - ubuntu-2404 suite: - chef-workstation - inspec @@ -62,44 +62,6 @@ jobs: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.dokken.yml - - integration-windows-2016: - runs-on: windows-2016 - strategy: - matrix: - os: - - windows-2016 - suite: - - chef-workstation - - inspec - fail-fast: false - steps: - - name: Check windows Version - run: systeminfo - - name: Check out code - uses: actions/checkout@main - - name: Install Chef - uses: actionshub/chef-install@main - - name: Test-Kitchen Converge - uses: actionshub/test-kitchen@main - with: - suite: ${{ matrix.suite }} - os: ${{ matrix.os }} - action: converge - env: - CHEF_LICENSE: accept-no-persist - KITCHEN_LOCAL_YAML: kitchen.exec.yml - continue-on-error: false - - name: Test-Kitchen Verify - uses: actionshub/test-kitchen@main - with: - suite: ${{ matrix.suite }} - os: ${{ matrix.os }} - action: verify - env: - CHEF_LICENSE: accept-no-persist - KITCHEN_LOCAL_YAML: kitchen.exec.yml - integration-windows-2019: runs-on: windows-2019 strategy: @@ -219,7 +181,6 @@ jobs: - jsonlint - cookstylelint - integration-dokken - - integration-windows-2016 - integration-windows-2019 - integration-windows-2022 - integration-macos-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d3dd04..3048cdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This file is used to list changes made in each version of the chef-ingredient cookbook. +## 3.5.1 (2024-10-02) + +- Add deprecation warning log notice for chef backend resource + ## 3.5.0 (2022-07-28) - Added attribute to specify mixlib-install version, defaults to nil to install latest version - [@stromweld](https://github.com/stromweld) diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 0d52809..5f465b0 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -66,23 +66,23 @@ platforms: image: dokken/fedora-latest pid_one_command: /usr/lib/systemd/systemd - - name: ubuntu-18.04 + - name: ubuntu-20.04 driver: - image: dokken/ubuntu-18.04 + image: dokken/ubuntu-20.04 pid_one_command: /bin/systemd intermediate_instructions: - RUN /usr/bin/apt-get update - - name: ubuntu-20.04 + - name: ubuntu-22.04 driver: - image: dokken/ubuntu-20.04 + image: dokken/ubuntu-22.04 pid_one_command: /bin/systemd intermediate_instructions: - RUN /usr/bin/apt-get update - - name: ubuntu-22.04 + - name: ubuntu-24.04 driver: - image: dokken/ubuntu-22.04 + image: dokken/ubuntu-24.04 pid_one_command: /bin/systemd intermediate_instructions: - RUN /usr/bin/apt-get update diff --git a/metadata.rb b/metadata.rb index 4a36457..b566f30 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@chef.io' license 'Apache-2.0' description 'Primitives for managing Chef products and packages' -version '3.5.0' +version '3.5.1' %w(amazon centos redhat scientific oracle fedora debian ubuntu).each do |os| supports os diff --git a/resources/automatev2.rb b/resources/automatev2.rb index 2004fe2..89beb1a 100644 --- a/resources/automatev2.rb +++ b/resources/automatev2.rb @@ -37,7 +37,6 @@ not_if { FileTest.file?(bin_path) } end - ## TODO: add dependancy on sysctl cookbook unless chef-client v14.0+ sysctl 'vm.max_map_count' do value 262144 end diff --git a/resources/backend.rb b/resources/backend.rb index 66df5da..644fc79 100644 --- a/resources/backend.rb +++ b/resources/backend.rb @@ -45,6 +45,8 @@ action :create do raise 'Must accept the Chef License agreement before continuing.' unless new_resource.accept_license + Chef::Log.warn('The chef_backend resource is deprecated in favor of Automate HA') + new_resource.config = ensurekv(new_resource.config, publish_address: new_resource.publish_address) chef_ingredient 'chef-backend' do action :upgrade From dd803e061cdde80c972cd11e8283210dc75a9104 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Wed, 2 Oct 2024 12:17:43 -0500 Subject: [PATCH 2/6] linting Signed-off-by: Corey Hemminger --- .github/workflows/ci.yml | 8 ++++---- .rubocop.yml | 7 ++++++- Policyfile.rb | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4edff28..3048033 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,16 +3,16 @@ on: jobs: markdownlint: - uses: Stromweld/github-workflows/.github/workflows/markdownlint.yml@main + uses: Stromweld/github-workflows/.github/workflows/markdown-lint.yml@main yamllint: - uses: Stromweld/github-workflows/.github/workflows/yamllint.yml@main + uses: Stromweld/github-workflows/.github/workflows/yaml-lint.yml@main jsonlint: - uses: Stromweld/github-workflows/.github/workflows/jsonlint.yml@main + uses: Stromweld/github-workflows/.github/workflows/json-lint.yml@main cookstylelint: - uses: Stromweld/github-workflows/.github/workflows/cookstylelint.yml@main + uses: Stromweld/github-workflows/.github/workflows/cookstyle-lint.yml@main integration-dokken: runs-on: ubuntu-latest diff --git a/.rubocop.yml b/.rubocop.yml index 2c347c4..7955d9b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,8 @@ --- AllCops: - TargetChefVersion: 17.0 + TargetRubyVersion: 3.1 + Include: + - "**/*.rb" + Exclude: + - "vendor/**/*" + - "spec/**/*" diff --git a/Policyfile.rb b/Policyfile.rb index b1fe448..b8bd346 100644 --- a/Policyfile.rb +++ b/Policyfile.rb @@ -16,7 +16,7 @@ named_run_list :test_repo, %w(test::install_git test test::repo) named_run_list :test_local, %w(test::install_git test test::local) named_run_list :test_chef_workstation, 'test::chef_workstation' -named_run_list :test_inspec,'test::inspec' +named_run_list :test_inspec, 'test::inspec' named_run_list :test_chef_server, 'test::chef_server_noaddons' named_run_list :test_chef_automatev2, 'test::automatev2' From ffaa63ab3bf89c5ad6cf73908d098630b0dab773 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Wed, 2 Oct 2024 12:38:02 -0500 Subject: [PATCH 3/6] linting Signed-off-by: Corey Hemminger --- .github/workflows/ci.yml | 2 -- CHANGELOG.md | 28 +++++++++---------- README.md | 4 +-- kitchen.dokken.yml | 10 ------- kitchen.yml | 16 +++++------ resources/automatev2.rb | 3 +- .../cookbooks/test/recipes/automatev2.rb | 1 + 7 files changed, 26 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3048033..c9ea4c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,8 +19,6 @@ jobs: strategy: matrix: os: - - centos-7 - - centos-8 - almalinux-8 - almalinux-9 - ubuntu-2004 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3048cdb..6856986 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,20 +47,20 @@ This file is used to list changes made in each version of the chef-ingredient co - Cookstyle 6.2.9 Fixes - [@xorimabot](https://github.com/xorimabot) - Update platforms we test on - [@tas50](https://github.com/tas50) - Cookstyle Fixes including Chef Infra Client 16 compatibility - [@xorimabot](https://github.com/xorimabot) - - resolved cookstyle error: resources/chef_ingredient.rb:19:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` - - resolved cookstyle error: resources/ingredient_config.rb:18:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` - - resolved cookstyle error: resources/omnibus_service.rb:18:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` - - resolved cookstyle error: resources/backend.rb:28:45 refactor: `ChefCorrectness/LazyEvalNodeAttributeDefaults` - - resolved cookstyle error: resources/chef_org.rb:31:36 refactor: `ChefModernize/ShellOutHelper` - - resolved cookstyle error: resources/chef_org.rb:32:35 refactor: `ChefModernize/ShellOutHelper` - - resolved cookstyle error: resources/chef_user.rb:32:36 refactor: `ChefModernize/ShellOutHelper` - - resolved cookstyle error: resources/wf_builder.rb:260:9 refactor: `ChefModernize/ShellOutHelper` - - resolved cookstyle error: resources/wf_builder.rb:274:18 refactor: `ChefModernize/ShellOutHelper` - - resolved cookstyle error: spec/unit/recipes/test_default_handler_spec.rb:20:7 warning: `ChefDeprecations/DeprecatedChefSpecPlatform` - - resolved cookstyle error: libraries/helpers.rb:254:11 refactor: `ChefCorrectness/ChefApplicationFatal` - - resolved cookstyle error: resources/automatev2.rb:48:5 refactor: `ChefCorrectness/ConditionalRubyShellout` - - resolved cookstyle error: resources/wf_builder.rb:207:11 refactor: `ChefStyle/UsePlatformHelpers` - - resolved cookstyle error: resources/wf_builder.rb:210:11 refactor: `ChefStyle/UsePlatformHelpers` + - resolved cookstyle error: resources/chef_ingredient.rb:19:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` + - resolved cookstyle error: resources/ingredient_config.rb:18:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` + - resolved cookstyle error: resources/omnibus_service.rb:18:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` + - resolved cookstyle error: resources/backend.rb:28:45 refactor: `ChefCorrectness/LazyEvalNodeAttributeDefaults` + - resolved cookstyle error: resources/chef_org.rb:31:36 refactor: `ChefModernize/ShellOutHelper` + - resolved cookstyle error: resources/chef_org.rb:32:35 refactor: `ChefModernize/ShellOutHelper` + - resolved cookstyle error: resources/chef_user.rb:32:36 refactor: `ChefModernize/ShellOutHelper` + - resolved cookstyle error: resources/wf_builder.rb:260:9 refactor: `ChefModernize/ShellOutHelper` + - resolved cookstyle error: resources/wf_builder.rb:274:18 refactor: `ChefModernize/ShellOutHelper` + - resolved cookstyle error: spec/unit/recipes/test_default_handler_spec.rb:20:7 warning: `ChefDeprecations/DeprecatedChefSpecPlatform` + - resolved cookstyle error: libraries/helpers.rb:254:11 refactor: `ChefCorrectness/ChefApplicationFatal` + - resolved cookstyle error: resources/automatev2.rb:48:5 refactor: `ChefCorrectness/ConditionalRubyShellout` + - resolved cookstyle error: resources/wf_builder.rb:207:11 refactor: `ChefStyle/UsePlatformHelpers` + - resolved cookstyle error: resources/wf_builder.rb:210:11 refactor: `ChefStyle/UsePlatformHelpers` ## 3.1.2 (2019-10-02) diff --git a/README.md b/README.md index 8d4eea5..723b93e 100644 --- a/README.md +++ b/README.md @@ -187,8 +187,8 @@ Installs Chef Automate version 2 #### chef_backend Properties - `bootstrap_node` - The node we'll bootstrap secrets with. -- `publish_address` - node['ipaddress'] | The address you want Chef-Backend to listen on. -- `chef_backend_secrets` - A location where your secrets are | we recommend using the chef_file resource. +- `publish_address` - node['ipaddress'] - The address you want Chef-Backend to listen on. +- `chef_backend_secrets` - A location where your secrets are - we recommend using the chef_file resource. - `chef_backend_secrets_user` - The user that owns the file created by the `chef_backend_secrets` attribute - `chef_backend_secrets_group` - The group that owns the file created by the `chef_backend_secrets` attribute diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 5f465b0..92d10ec 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -51,16 +51,6 @@ platforms: intermediate_instructions: - RUN /usr/bin/apt-get update - - name: centos-7 - driver: - image: dokken/centos-7 - pid_one_command: /usr/lib/systemd/systemd - - - name: centos-8 - driver: - image: dokken/centos-8 - pid_one_command: /usr/lib/systemd/systemd - - name: fedora-latest driver: image: dokken/fedora-latest diff --git a/kitchen.yml b/kitchen.yml index 6a4b161..e2ef690 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -29,8 +29,6 @@ platforms: - name: almalinux-8 - name: almalinux-9 - name: amazonlinux-2 - - name: centos-7 - - name: centos-8 - name: debian-10 - name: debian-11 - name: fedora-latest @@ -42,9 +40,9 @@ platforms: - name: ubuntu-18.04 - name: ubuntu-20.04 - name: ubuntu-22.04 - - name: macos-10.12 + - name: macos-14 driver: - box: chef/macos-10.12 # private + box: chef/macos-14 # private - name: macos-latest # Used for CI pipeline - name: windows-2016 driver: @@ -64,15 +62,15 @@ platforms: suites: - name: default - excludes: ['macos-10.12', 'macos-latest', 'windows-2016', 'windows-2019', 'windows-2022'] + excludes: ['macos-14', 'macos-latest', 'windows-2016', 'windows-2019', 'windows-2022'] named_run_list: test_repo - name: local-package-install - excludes: ['macos-10.12', 'macos-latest', 'windows-2016', 'windows-2019', 'windows-2022'] + excludes: ['macos-14', 'macos-latest', 'windows-2016', 'windows-2019', 'windows-2022'] named_run_list: test_local - name: rubygems-url - excludes: ['macos-10.12', 'macos-latest', 'windows-2016', 'windows-2019', 'windows-2022'] + excludes: ['macos-14', 'macos-latest', 'windows-2016', 'windows-2019', 'windows-2022'] named_run_list: test_rubygems_url - name: chef-workstation @@ -82,12 +80,12 @@ suites: named_run_list: test_inspec - name: chef-server - includes: ['almalinux-8', 'almalinux-9', 'rockylinux-8', 'rockylinux-9', 'ubuntu-18.04', 'ubuntu-20.04', 'ubuntu-22.04', 'centos-7', 'centos-8'] + includes: ['almalinux-8', 'almalinux-9', 'rockylinux-8', 'rockylinux-9', 'ubuntu-20.04', 'ubuntu-22.04', 'ubuntu-24.04'] named_run_list: test_chef_server - name: chef-automatev2 driver: customize: memory: 2560 - includes: ['almalinux-8', 'almalinux-9', 'rockylinux-8', 'rockylinux-9', 'ubuntu-18.04', 'ubuntu-20.04', 'ubuntu-22.04', 'centos-7', 'centos-8'] + includes: ['almalinux-8', 'almalinux-9', 'rockylinux-8', 'rockylinux-9', 'ubuntu-20.04', 'ubuntu-22.04', 'ubuntu-24.04'] named_run_list: test_chef_automatev2 diff --git a/resources/automatev2.rb b/resources/automatev2.rb index 89beb1a..650b802 100644 --- a/resources/automatev2.rb +++ b/resources/automatev2.rb @@ -24,6 +24,7 @@ property :config, String, required: true property :accept_license, [true, false], default: false property :products, Array, default: ['automate'] +property :skip_verify, [TrueClass, FalseClass], default: false action :create do bin_path = value_for_platform_family( @@ -51,7 +52,7 @@ only_if { FileTest.file?('/usr/local/bin/chef-automate') } end - execute "/usr/local/bin/chef-automate deploy #{Chef::Config[:file_cache_path]}/config.toml --product #{new_resource.products.join(' --product ')}#{' --accept-terms-and-mlsa' if new_resource.accept_license}" do + execute "/usr/local/bin/chef-automate deploy #{Chef::Config[:file_cache_path]}/config.toml#{' --skip-verify' if new_resource.skip_verify} --product #{new_resource.products.join(' --product ')}#{' --accept-terms-and-mlsa' if new_resource.accept_license}" do cwd Chef::Config[:file_cache_path] live_stream true only_if { FileTest.file?("#{Chef::Config[:file_cache_path]}/config.toml") } diff --git a/test/fixtures/cookbooks/test/recipes/automatev2.rb b/test/fixtures/cookbooks/test/recipes/automatev2.rb index db4af9a..2536843 100644 --- a/test/fixtures/cookbooks/test/recipes/automatev2.rb +++ b/test/fixtures/cookbooks/test/recipes/automatev2.rb @@ -5,4 +5,5 @@ EOS products %w(automate infra-server builder desktop) accept_license true + skip_verify true end From 9f5a90afc315d6658028df82dafa1f26900ee338 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Wed, 2 Oct 2024 12:50:47 -0500 Subject: [PATCH 4/6] test fix Signed-off-by: Corey Hemminger --- kitchen.yml | 2 +- resources/automatev2.rb | 4 ++-- test/fixtures/cookbooks/test/recipes/automatev2.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kitchen.yml b/kitchen.yml index e2ef690..b2e1d20 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -80,7 +80,7 @@ suites: named_run_list: test_inspec - name: chef-server - includes: ['almalinux-8', 'almalinux-9', 'rockylinux-8', 'rockylinux-9', 'ubuntu-20.04', 'ubuntu-22.04', 'ubuntu-24.04'] + includes: ['almalinux-8', 'almalinux-9', 'rockylinux-8', 'rockylinux-9', 'ubuntu-20.04', 'ubuntu-22.04'] named_run_list: test_chef_server - name: chef-automatev2 diff --git a/resources/automatev2.rb b/resources/automatev2.rb index 650b802..4cd1962 100644 --- a/resources/automatev2.rb +++ b/resources/automatev2.rb @@ -24,7 +24,7 @@ property :config, String, required: true property :accept_license, [true, false], default: false property :products, Array, default: ['automate'] -property :skip_verify, [TrueClass, FalseClass], default: false +property :skip_preflight, [TrueClass, FalseClass], default: false action :create do bin_path = value_for_platform_family( @@ -52,7 +52,7 @@ only_if { FileTest.file?('/usr/local/bin/chef-automate') } end - execute "/usr/local/bin/chef-automate deploy #{Chef::Config[:file_cache_path]}/config.toml#{' --skip-verify' if new_resource.skip_verify} --product #{new_resource.products.join(' --product ')}#{' --accept-terms-and-mlsa' if new_resource.accept_license}" do + execute "/usr/local/bin/chef-automate deploy #{Chef::Config[:file_cache_path]}/config.toml#{' --skip-preflight' if new_resource.skip_preflight} --product #{new_resource.products.join(' --product ')}#{' --accept-terms-and-mlsa' if new_resource.accept_license}" do cwd Chef::Config[:file_cache_path] live_stream true only_if { FileTest.file?("#{Chef::Config[:file_cache_path]}/config.toml") } diff --git a/test/fixtures/cookbooks/test/recipes/automatev2.rb b/test/fixtures/cookbooks/test/recipes/automatev2.rb index 2536843..4b249f7 100644 --- a/test/fixtures/cookbooks/test/recipes/automatev2.rb +++ b/test/fixtures/cookbooks/test/recipes/automatev2.rb @@ -5,5 +5,5 @@ EOS products %w(automate infra-server builder desktop) accept_license true - skip_verify true + skip_preflight true end From c8a21a9efbdb95bd2b255d1931690c92c4a85464 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Wed, 2 Oct 2024 13:06:47 -0500 Subject: [PATCH 5/6] test fix Signed-off-by: Corey Hemminger --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9ea4c4..f3af45f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,9 +30,7 @@ jobs: - chef-server - chef-automatev2 exclude: - - os: centos-7 - suite: chef-server - - os: ubuntu-2204 + - os: ubuntu-2404 suite: chef-server fail-fast: false steps: From 2bc01305d7638d5ea21e0ef4d78c66de6078ae6e Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Wed, 2 Oct 2024 14:20:35 -0500 Subject: [PATCH 6/6] PR review updates Signed-off-by: Corey Hemminger --- kitchen.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kitchen.yml b/kitchen.yml index b2e1d20..0197335 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -37,12 +37,12 @@ platforms: - name: opensuse-leap-15 - name: rockylinux-8 - name: rockylinux-9 - - name: ubuntu-18.04 - name: ubuntu-20.04 - name: ubuntu-22.04 + - name: ubuntu-24.04 - name: macos-14 driver: - box: chef/macos-14 # private + box: stromweld/macos-14 - name: macos-latest # Used for CI pipeline - name: windows-2016 driver: