From 5b8b7c5c5a28d5ca4f185eb68e51434eaa96d455 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Thu, 11 Dec 2025 12:13:04 +0000 Subject: [PATCH] apt: Force reinstall of hpe mcp renewed key --- .kitchen.yml | 1 + .../apt/recipes/management-component-pack.rb | 29 +++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index d0888be33..de96273fe 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -102,6 +102,7 @@ suites: - name: apt run_list: - recipe[apt::default] + - recipe[apt::management-component-pack] - name: apt-repository run_list: - recipe[apt::repository] diff --git a/cookbooks/apt/recipes/management-component-pack.rb b/cookbooks/apt/recipes/management-component-pack.rb index b94d3ccac..a67bae0b0 100644 --- a/cookbooks/apt/recipes/management-component-pack.rb +++ b/cookbooks/apt/recipes/management-component-pack.rb @@ -24,6 +24,11 @@ apt_repository "management-component-pack" do end if platform?("debian") + # Force re-download of keyring + file "/etc/apt/keyrings/mcp.gpg" do + action :delete + only_if { ::File.exist?("/etc/apt/keyrings/mcp.gpg") && ::File.mtime("/etc/apt/keyrings/mcp.gpg").to_date < Date.new(2025, 12, 9) } + end apt_repository "mcp" do uri "https://downloads.linux.hpe.com/SDR/repo/mcp" distribution "#{node[:lsb][:codename]}/current" @@ -31,7 +36,12 @@ if platform?("debian") key ["https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key1.pub", "https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key2.pub"] end - if node[:dmi][:system][:product_name].end_with?("Gen9") + if node.dig(:dmi, :system, :product_name).to_s.end_with?("Gen9") + # Force re-download of keyring + file "/etc/apt/keyrings/mcp-gen9.gpg" do + action :delete + only_if { ::File.exist?("/etc/apt/keyrings/mcp-gen9.gpg") && ::File.mtime("/etc/apt/keyrings/mcp-gen9.gpg").to_date < Date.new(2025, 12, 9) } + end apt_repository "mcp-gen9" do uri "https://downloads.linux.hpe.com/SDR/repo/mcp" distribution "stretch/current-gen9" @@ -40,7 +50,12 @@ if platform?("debian") end end elsif platform?("ubuntu") - if node[:dmi][:system][:product_name].end_with?("Gen10") + if node.dig(:dmi, :system, :product_name).to_s.end_with?("Gen10") + # Force re-download of keyring + file "/etc/apt/keyrings/mcp-jammy.gpg" do + action :delete + only_if { ::File.exist?("/etc/apt/keyrings/mcp-jammy.gpg") && ::File.mtime("/etc/apt/keyrings/mcp-jammy.gpg").to_date < Date.new(2025, 12, 9) } + end apt_repository "mcp-jammy" do uri "https://downloads.linux.hpe.com/SDR/repo/mcp" distribution "jammy/current" @@ -48,6 +63,11 @@ elsif platform?("ubuntu") key ["https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key1.pub", "https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key2.pub"] end + # Force re-download of keyring + file "/etc/apt/keyrings/mcp-focal-gen10.gpg" do + action :delete + only_if { ::File.exist?("/etc/apt/keyrings/mcp-focal-gen10.gpg") && ::File.mtime("/etc/apt/keyrings/mcp-focal-gen10.gpg").to_date < Date.new(2025, 12, 9) } + end apt_repository "mcp-focal-gen10" do uri "https://downloads.linux.hpe.com/SDR/repo/mcp" distribution "focal/current-gen10" @@ -55,6 +75,11 @@ elsif platform?("ubuntu") key ["https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key1.pub", "https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key2.pub"] end else + # Force re-download of keyring + file "/etc/apt/keyrings/mcp-bionic-gen9.gpg" do + action :delete + only_if { ::File.exist?("/etc/apt/keyrings/mcp-bionic-gen9.gpg") && ::File.mtime("/etc/apt/keyrings/mcp-bionic-gen9.gpg").to_date < Date.new(2025, 12, 9) } + end apt_repository "mcp-bionic-gen9" do uri "https://downloads.linux.hpe.com/SDR/repo/mcp" distribution "bionic/current-gen9" -- 2.39.5