From d9be6ad3503a073841d5bf307ebdea6b39f82543 Mon Sep 17 00:00:00 2001 From: Nicola Sirena Date: Thu, 21 Dec 2023 14:51:58 +0100 Subject: [PATCH] Remove mysql_repo resource The package provided by mysql to configure mysql-repos ships a key that will eventually expire and cause errors during an apt-update since the verification of the repositories will fail. We are going to remove it since the benefit of having it configured in the AMI weight less than the negative aspects. Signed-off-by: Nicola Sirena --- .../kitchen.slurm-install.yml | 9 ---- .../recipes/install.rb | 1 - .../mysql_repo/mysql_repo_amazon2.rb | 25 ----------- .../mysql_repo/mysql_repo_centos7.rb | 27 ------------ .../mysql_repo/mysql_repo_redhat8.rb | 27 ------------ .../resources/mysql_repo/mysql_repo_rocky8.rb | 27 ------------ .../mysql_repo/mysql_repo_ubuntu20+.rb | 27 ------------ .../mysql_repo/partial/_mysql_repo_deb.rb | 41 ------------------- .../mysql_repo/partial/_mysql_repo_rpm.rb | 35 ---------------- .../test/controls/mysql_repo_spec.rb | 29 ------------- 10 files changed, 248 deletions(-) delete mode 100644 cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_amazon2.rb delete mode 100644 cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_centos7.rb delete mode 100644 cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_redhat8.rb delete mode 100644 cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_rocky8.rb delete mode 100644 cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_ubuntu20+.rb delete mode 100644 cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/partial/_mysql_repo_deb.rb delete mode 100644 cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/partial/_mysql_repo_rpm.rb delete mode 100644 cookbooks/aws-parallelcluster-slurm/test/controls/mysql_repo_spec.rb diff --git a/cookbooks/aws-parallelcluster-slurm/kitchen.slurm-install.yml b/cookbooks/aws-parallelcluster-slurm/kitchen.slurm-install.yml index 04666c35a..1368a9514 100644 --- a/cookbooks/aws-parallelcluster-slurm/kitchen.slurm-install.yml +++ b/cookbooks/aws-parallelcluster-slurm/kitchen.slurm-install.yml @@ -34,15 +34,6 @@ suites: - /mysql_client/ attributes: resource: mysql_client - - name: mysql_repo_add - run_list: - - recipe[aws-parallelcluster-tests::setup] - - recipe[aws-parallelcluster-tests::test_resource] - verifier: - controls: - - tag:install_mysql_repo_added - attributes: - resource: mysql_repo:add - name: munge run_list: - recipe[aws-parallelcluster-tests::setup] diff --git a/cookbooks/aws-parallelcluster-slurm/recipes/install.rb b/cookbooks/aws-parallelcluster-slurm/recipes/install.rb index 7139a27e2..095c7ce95 100644 --- a/cookbooks/aws-parallelcluster-slurm/recipes/install.rb +++ b/cookbooks/aws-parallelcluster-slurm/recipes/install.rb @@ -17,7 +17,6 @@ dns_domain "Install dns related packages" mysql_client 'Install mysql client' -mysql_repo 'Configure mysql repository' include_recipe 'aws-parallelcluster-slurm::install_jwt' include_recipe 'aws-parallelcluster-slurm::install_pmix' munge 'Install munge' do diff --git a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_amazon2.rb b/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_amazon2.rb deleted file mode 100644 index 1edbf8a73..000000000 --- a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_amazon2.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). -# You may not use this file except in compliance with the License. -# A copy of the License is located at -# -# http://aws.amazon.com/apache2.0/ -# -# or in the "LICENSE.txt" file accompanying this file. -# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. -# See the License for the specific language governing permissions and limitations under the License. - -provides :mysql_repo, platform: 'amazon', platform_version: '2' - -use 'partial/_mysql_repo_rpm.rb' - -def md5_signature - '42048ccae58835e40e37b68a3f8b91fb' -end - -def file_name - 'mysql80-community-release-el7-11.noarch.rpm' -end diff --git a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_centos7.rb b/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_centos7.rb deleted file mode 100644 index 1c4eb8ce4..000000000 --- a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_centos7.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). -# You may not use this file except in compliance with the License. -# A copy of the License is located at -# -# http://aws.amazon.com/apache2.0/ -# -# or in the "LICENSE.txt" file accompanying this file. -# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. -# See the License for the specific language governing permissions and limitations under the License. - -provides :mysql_repo, platform: 'centos' do |node| - node['platform_version'].to_i == 7 -end - -use 'partial/_mysql_repo_rpm.rb' - -def md5_signature - '42048ccae58835e40e37b68a3f8b91fb' -end - -def file_name - 'mysql80-community-release-el7-11.noarch.rpm' -end diff --git a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_redhat8.rb b/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_redhat8.rb deleted file mode 100644 index d11eed55b..000000000 --- a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_redhat8.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). -# You may not use this file except in compliance with the License. -# A copy of the License is located at -# -# http://aws.amazon.com/apache2.0/ -# -# or in the "LICENSE.txt" file accompanying this file. -# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. -# See the License for the specific language governing permissions and limitations under the License. - -provides :mysql_repo, platform: 'redhat' do |node| - node['platform_version'].to_i == 8 -end - -use 'partial/_mysql_repo_rpm.rb' - -def md5_signature - '42048ccae58835e40e37b68a3f8b91fb' -end - -def file_name - 'mysql80-community-release-el8-9.noarch.rpm' -end diff --git a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_rocky8.rb b/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_rocky8.rb deleted file mode 100644 index d02a2b5d4..000000000 --- a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_rocky8.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). -# You may not use this file except in compliance with the License. -# A copy of the License is located at -# -# http://aws.amazon.com/apache2.0/ -# -# or in the "LICENSE.txt" file accompanying this file. -# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. -# See the License for the specific language governing permissions and limitations under the License. - -provides :mysql_repo, platform: 'rocky' do |node| - node['platform_version'].to_i == 8 -end - -use 'partial/_mysql_repo_rpm.rb' - -def md5_signature - '42048ccae58835e40e37b68a3f8b91fb' -end - -def file_name - 'mysql80-community-release-el8-9.noarch.rpm' -end diff --git a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_ubuntu20+.rb b/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_ubuntu20+.rb deleted file mode 100644 index 68f6f3d82..000000000 --- a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/mysql_repo_ubuntu20+.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). -# You may not use this file except in compliance with the License. -# A copy of the License is located at -# -# http://aws.amazon.com/apache2.0/ -# -# or in the "LICENSE.txt" file accompanying this file. -# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. -# See the License for the specific language governing permissions and limitations under the License. - -provides :mysql_repo, platform: 'ubuntu' do |node| - node['platform_version'].to_i >= 20 -end - -use 'partial/_mysql_repo_deb.rb' - -def md5_signature - '42048ccae58835e40e37b68a3f8b91fb' -end - -def file_name - 'mysql-apt-config_0.8.26-1_all.deb' -end diff --git a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/partial/_mysql_repo_deb.rb b/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/partial/_mysql_repo_deb.rb deleted file mode 100644 index 9916ecf51..000000000 --- a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/partial/_mysql_repo_deb.rb +++ /dev/null @@ -1,41 +0,0 @@ -unified_mode true -default_action :add - -action :add do - remote_file local_path do - source repository_package - mode '0644' - retries 3 - retry_delay 5 - action :create_if_missing - end - - ruby_block "Validate Repository Definition Checksum" do - block do - validate_file_md5_hash(local_path, md5_signature) - end - not_if { ::File.exist?(local_path) } - end - - dpkg_package repository_name do - source local_path - end - - apt_update 'update' do - action :update - retries 3 - retry_delay 5 - end -end - -def repository_name - 'MySQL Repository' -end - -def repository_package - "https://dev.mysql.com/get/#{file_name}" -end - -def local_path - "/tmp/#{file_name}" -end diff --git a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/partial/_mysql_repo_rpm.rb b/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/partial/_mysql_repo_rpm.rb deleted file mode 100644 index 3c59e193e..000000000 --- a/cookbooks/aws-parallelcluster-slurm/resources/mysql_repo/partial/_mysql_repo_rpm.rb +++ /dev/null @@ -1,35 +0,0 @@ -unified_mode true -default_action :add - -action :add do - remote_file local_path do - source repository_package - mode '0644' - retries 3 - retry_delay 5 - action :create_if_missing - end - - ruby_block "Validate Repository Definition Checksum" do - block do - validate_file_md5_hash(local_path, md5_signature) - end - not_if { ::File.exist?(local_path) } - end - - package repository_name do - source local_path - end -end - -def repository_name - 'MySQL Repository' -end - -def repository_package - "https://dev.mysql.com/get/#{file_name}" -end - -def local_path - "/tmp/#{file_name}" -end diff --git a/cookbooks/aws-parallelcluster-slurm/test/controls/mysql_repo_spec.rb b/cookbooks/aws-parallelcluster-slurm/test/controls/mysql_repo_spec.rb deleted file mode 100644 index 3b1839e59..000000000 --- a/cookbooks/aws-parallelcluster-slurm/test/controls/mysql_repo_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). -# You may not use this file except in compliance with the License. A copy of the License is located at -# -# http://aws.amazon.com/apache2.0/ -# -# or in the "LICENSE.txt" file accompanying this file. -# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. -# See the License for the specific language governing permissions and limitations under the License. - -control 'tag:install_mysql_repo_added' do - if os_properties.ubuntu? - describe file('/etc/apt/sources.list.d/mysql.list') do - it { should exist } - its('content') { should match /mysql-apt-config/ } - its('content') { should match /mysql-8.0/ } - its('content') { should match /mysql-tools/ } - its('content') { should match /mysql-tools-preview/ } - end - else - %w(mysql-connectors-community mysql-tools-community mysql80-community).each do |repo_name| - describe yum.repo(repo_name) do - it { should exist } - it { should be_enabled } - end - end - end -end