]> git.openstreetmap.org Git - chef.git/blob - cookbooks/apt/recipes/management-component-pack.rb
apt: Force reinstall of hpe mcp renewed key
[chef.git] / cookbooks / apt / recipes / management-component-pack.rb
1 #
2 # Cookbook:: apt
3 # Recipe:: management-component-pack
4 #
5 # Copyright:: 2022, Tom Hughes
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     https://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 include_recipe "apt"
21
22 apt_repository "management-component-pack" do
23   action :remove
24 end
25
26 if platform?("debian")
27   # Force re-download of keyring
28   file "/etc/apt/keyrings/mcp.gpg" do
29     action :delete
30     only_if { ::File.exist?("/etc/apt/keyrings/mcp.gpg") && ::File.mtime("/etc/apt/keyrings/mcp.gpg").to_date < Date.new(2025, 12, 9) }
31   end
32   apt_repository "mcp" do
33     uri "https://downloads.linux.hpe.com/SDR/repo/mcp"
34     distribution "#{node[:lsb][:codename]}/current"
35     components ["non-free"]
36     key ["https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key1.pub", "https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key2.pub"]
37   end
38
39   if node.dig(:dmi, :system, :product_name).to_s.end_with?("Gen9")
40     # Force re-download of keyring
41     file "/etc/apt/keyrings/mcp-gen9.gpg" do
42       action :delete
43       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) }
44     end
45     apt_repository "mcp-gen9" do
46       uri "https://downloads.linux.hpe.com/SDR/repo/mcp"
47       distribution "stretch/current-gen9"
48       components ["non-free"]
49       key ["https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key1.pub", "https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key2.pub"]
50     end
51   end
52 elsif platform?("ubuntu")
53   if node.dig(:dmi, :system, :product_name).to_s.end_with?("Gen10")
54     # Force re-download of keyring
55     file "/etc/apt/keyrings/mcp-jammy.gpg" do
56       action :delete
57       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) }
58     end
59     apt_repository "mcp-jammy" do
60       uri "https://downloads.linux.hpe.com/SDR/repo/mcp"
61       distribution "jammy/current"
62       components ["non-free"]
63       key ["https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key1.pub", "https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key2.pub"]
64     end
65
66     # Force re-download of keyring
67     file "/etc/apt/keyrings/mcp-focal-gen10.gpg" do
68       action :delete
69       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) }
70     end
71     apt_repository "mcp-focal-gen10" do
72       uri "https://downloads.linux.hpe.com/SDR/repo/mcp"
73       distribution "focal/current-gen10"
74       components ["non-free"]
75       key ["https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key1.pub", "https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key2.pub"]
76     end
77   else
78     # Force re-download of keyring
79     file "/etc/apt/keyrings/mcp-bionic-gen9.gpg" do
80       action :delete
81       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) }
82     end
83     apt_repository "mcp-bionic-gen9" do
84       uri "https://downloads.linux.hpe.com/SDR/repo/mcp"
85       distribution "bionic/current-gen9"
86       components ["non-free"]
87       key ["https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key1.pub", "https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key2.pub"]
88     end
89   end
90 end