cem_acpt 0.12.2 → 0.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e37459e007c8e05a53fddf7920cefb42223e7e490785a3601372fdf172de82f
4
- data.tar.gz: 1147801fce2be7b5d0a1847d817449ad2492c8ec04707d5a82713663b2406804
3
+ metadata.gz: 0670fc107d34a475c456d55ee179f24488d862e24ca3eb58b1645bf994ebc216
4
+ data.tar.gz: e39cb29afd796dea81395ab17cc6bf6107202221a0ac1e927e5bdad256db6a61
5
5
  SHA512:
6
- metadata.gz: e3e28851afbfdeeb9a2d4ca0cfc0fb10f304ba121111422416f5a50757fc9ea50bdc30db20149d00b0d04dcf91d548e73c03276863601037417ce1c39a914090
7
- data.tar.gz: 232de289f1ba433d6e5c25737cadffc8641dae7052075e359e663f935225547b44f3e430f8509c9f2519f8d8abf41204b83c76964eee387cf554f45bafd04b49
6
+ metadata.gz: b4718840a0a1802a3b08ee469fd8857e6a6e5bbc4c26cf5902793d6e7e0eb5bae7efe781e8f354ad28edd951605c1270bee07f187e00532cb07ee3131e3f98ab
7
+ data.tar.gz: d9267e9d122d925f4384c638141f25be84a22a036fc60c4ad1319dacb302daafd144e04cc7dacf495f0d607f84ab401f6b4190006184cdcf967034ced6e70b54
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cem_acpt (0.12.2)
4
+ cem_acpt (0.12.3)
5
5
  async-http (>= 0.60, < 0.70)
6
6
  bcrypt_pbkdf (>= 1.0, < 2.0)
7
7
  deep_merge (>= 1.2, < 2.0)
@@ -97,10 +97,22 @@ module CemAcpt
97
97
  end
98
98
 
99
99
  class DebianFamily
100
- def initialize(config, image_name, base_image, os_major_version, puppet_version)
100
+ CODENAME_MAP = {
101
+ 'ubuntu' => {
102
+ '2004' => 'focal',
103
+ '2204' => 'jammy',
104
+ '2404' => 'noble',
105
+ },
106
+ 'debian' => {
107
+ '12' => 'bookworm',
108
+ },
109
+ }.freeze
110
+
111
+ def initialize(config, image_name, base_image, os_major_version, puppet_version, os: 'ubuntu')
101
112
  @config = config
102
113
  @image_name = image_name
103
114
  @base_image = base_image
115
+ @os = os
104
116
  @os_major_version = os_major_version
105
117
  @puppet_version = puppet_version
106
118
  end
@@ -121,8 +133,16 @@ module CemAcpt
121
133
 
122
134
  private
123
135
 
136
+ def apt_codename
137
+ CODENAME_MAP.dig(@os, @os_major_version) || 'focal'
138
+ end
139
+
140
+ def noninteractive?
141
+ (@os == 'ubuntu' && @os_major_version.to_i > 2004) || @os == 'debian'
142
+ end
143
+
124
144
  def upgrade_packages_command
125
- if @os_major_version.to_i > 2004
145
+ if noninteractive?
126
146
  'sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_SUSPEND=1 NEEDRESTART_MODE=a apt-get update &&'\
127
147
  ' sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_SUSPEND=1 NEEDRESTART_MODE=a apt-get upgrade -y'
128
148
  else
@@ -146,15 +166,15 @@ module CemAcpt
146
166
 
147
167
  # Update to the new private Puppet platform repository URL for apt
148
168
  def puppet_platform_repository_url
149
- "https://apt-puppetcore.puppet.com/public/puppet#{@puppet_version}-release-focal.deb"
169
+ "https://apt-puppetcore.puppet.com/public/puppet#{@puppet_version}-release-#{apt_codename}.deb"
150
170
  end
151
171
 
152
172
  def enable_puppet_repository_command
153
- "wget --content-disposition #{puppet_platform_repository_url} && sudo dpkg -i puppet#{@puppet_version}-release-focal.deb"
173
+ "wget --content-disposition #{puppet_platform_repository_url} && sudo dpkg -i puppet#{@puppet_version}-release-#{apt_codename}.deb"
154
174
  end
155
175
 
156
176
  def install_puppet_agent_command
157
- if @os_major_version.to_i > 2004
177
+ if noninteractive?
158
178
  'sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_SUSPEND=1 NEEDRESTART_MODE=a apt-get install -y puppet-agent'
159
179
  else
160
180
  'sudo apt-get install -y puppet-agent'
@@ -175,6 +195,7 @@ module CemAcpt
175
195
  'oel' => 'EnterpriseLinuxFamily',
176
196
  'rocky' => 'EnterpriseLinuxFamily',
177
197
  'ubuntu' => 'DebianFamily',
198
+ 'debian' => 'DebianFamily',
178
199
  'windows' => 'WindowsFamily',
179
200
  }.freeze
180
201
 
@@ -184,7 +205,12 @@ module CemAcpt
184
205
  cmd_klass = OS_CLASS_MAP[os.to_s]
185
206
  raise "Unsupported OS: #{os}" unless cmd_klass
186
207
 
187
- const_get(cmd_klass).new(config, image_name, base_image, os_major_version, puppet_version).provision_commands
208
+ klass = const_get(cmd_klass)
209
+ if klass == DebianFamily
210
+ klass.new(config, image_name, base_image, os_major_version, puppet_version, os: os.to_s).provision_commands
211
+ else
212
+ klass.new(config, image_name, base_image, os_major_version, puppet_version).provision_commands
213
+ end
188
214
  end
189
215
  end
190
216
  end
@@ -6,12 +6,15 @@ module CemAcpt
6
6
  module Provision
7
7
  # Class provides methods for gathering provision data for Linux nodes
8
8
  class Linux < OsData
9
+ GOSS_VERSION = 'v0.4.9'
10
+ GOSS_DOWNLOAD_URL = "https://github.com/goss-org/goss/releases/download/#{GOSS_VERSION}/goss-linux-amd64"
11
+
9
12
  def self.valid_names
10
- %w[centos rhel oel alma rocky ubuntu]
13
+ %w[centos rhel oel alma rocky ubuntu debian]
11
14
  end
12
15
 
13
16
  def self.valid_versions
14
- %w[7 8 9 10 2004 2204 2404]
17
+ %w[7 8 9 10 12 2004 2204 2404]
15
18
  end
16
19
 
17
20
  def systemd_files
@@ -29,7 +32,7 @@ module CemAcpt
29
32
  def provision_commands
30
33
  commands = [
31
34
  "sudo /opt/puppetlabs/puppet/bin/puppet module install #{destination_provision_directory}/#{remote_module_package_name}",
32
- 'curl -fsSL https://goss.rocks/install | sudo sh',
35
+ "sudo curl -fsSL #{GOSS_DOWNLOAD_URL} -o /usr/local/bin/goss && sudo chmod +rx /usr/local/bin/goss",
33
36
  'sudo /opt/puppetlabs/puppet/bin/gem install webrick',
34
37
  'sudo chmod +x /opt/cem_acpt/log_service/log_service.rb',
35
38
  'sudo /opt/cem_acpt/log_service/log_service.rb',
@@ -88,7 +91,7 @@ module CemAcpt
88
91
  'sudo dnf upgrade -y dnf',
89
92
  ]
90
93
  (commands << base).flatten
91
- elsif image_name.include?('ubuntu')
94
+ elsif image_name.include?('ubuntu') || image_name.include?('debian')
92
95
  commands = ['sudo apt purge -y unattended-upgrades', 'sudo apt-get update -y']
93
96
  (commands << base).flatten
94
97
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CemAcpt
4
- VERSION = '0.12.2'
4
+ VERSION = '0.12.4'
5
5
  end
@@ -0,0 +1,91 @@
1
+ # CEM-6827 — Fix Goss installation to bypass broken upstream install script
2
+
3
+ ## Summary
4
+
5
+ All acceptance tests across all branches are failing with `ECONNREFUSED` on ports 8080–8083.
6
+ The `cem_acpt` gem installs Goss on test VMs via `curl -fsSL https://goss.rocks/install | sudo sh`
7
+ (`lib/cem_acpt/provision/terraform/linux.rb:32`). The upstream install script was recently changed
8
+ to construct download URLs using a new naming convention (`goss_0.4.9_linux_x86_64.tar.gz`), but
9
+ existing releases still publish assets under the old format (`goss-linux-amd64`). The constructed
10
+ URL returns a 404, Goss is never installed, the health-check sidecar never starts, and every
11
+ acceptance test fails.
12
+
13
+ Replace the `curl | sh` invocation with a direct binary download from the GitHub releases page,
14
+ hard-pinned to Goss v0.4.9.
15
+
16
+ ## Goals
17
+
18
+ - Goss installs successfully on test VMs regardless of the state of the upstream install script.
19
+ - Acceptance tests pass the health-check stage and connect on ports 8080–8083.
20
+ - The Goss version is pinned to a known-good release (v0.4.9) so future upstream changes cannot silently break provisioning.
21
+
22
+ ## Non-goals
23
+
24
+ - Supporting architectures other than amd64 (all test VMs are x86_64).
25
+ - Adding SHA-256 checksum verification for the downloaded binary (the previous `curl | sh` had no verification either).
26
+ - Making the Goss version configurable via `cem_acpt` config.
27
+ - Windows Goss support (Windows nodes do not use Goss).
28
+ - Fixing or working around the upstream install script itself.
29
+
30
+ ## Proposed Design
31
+
32
+ ### `lib/cem_acpt/provision/terraform/linux.rb`
33
+
34
+ Add two constants at the top of the `Linux` class for the pinned version and download URL:
35
+
36
+ ```ruby
37
+ GOSS_VERSION = 'v0.4.9'
38
+ GOSS_DOWNLOAD_URL = "https://github.com/goss-org/goss/releases/download/#{GOSS_VERSION}/goss-linux-amd64"
39
+ ```
40
+
41
+ Replace the `curl | sh` line in `provision_commands`:
42
+
43
+ ```ruby
44
+ # before
45
+ 'curl -fsSL https://goss.rocks/install | sudo sh',
46
+
47
+ # after
48
+ "curl -fsSL #{GOSS_DOWNLOAD_URL} -o /usr/local/bin/goss && sudo chmod +rx /usr/local/bin/goss",
49
+ ```
50
+
51
+ This downloads the binary directly to `/usr/local/bin/goss` (the same location the old install script used) and makes it executable.
52
+
53
+ ## Edge Cases
54
+
55
+ - **Upstream install script is fixed later** — the direct download is stable regardless; no action needed. We can evaluate returning to the install script in a future ticket if desired.
56
+ - **Goss v0.4.9 release assets are removed from GitHub** — unlikely for a tagged release, but if it happens the download would 404 and `curl -f` would fail fast with a clear error rather than silently installing nothing.
57
+ - **Network failure during download** — `curl -f` returns a non-zero exit code, Terraform `remote-exec` aborts, and the provisioning error is surfaced to the operator. Same behavior as before.
58
+
59
+ ## Constraints / Invariants
60
+
61
+ - The Goss binary must land at `/usr/local/bin/goss` — all three systemd service units (`goss-acpt.service`, `goss-idempotent.service`, `goss-noop.service`) invoke `goss` by that path.
62
+ - `scan_provision_commands` is unaffected — it intentionally skips Goss installation.
63
+ - The `provision_commands_wrapper` method is unchanged; it delegates to `provision_commands` which picks up the new install command.
64
+
65
+ ## Test Plan
66
+
67
+ ### `spec/cem_acpt/provision/terraform/linux_spec.rb`
68
+
69
+ 1. Assert that `provision_commands` includes a command containing the `GOSS_DOWNLOAD_URL` constant value.
70
+ 2. Assert that `provision_commands` does **not** contain `goss.rocks/install`.
71
+ 3. Assert that the Goss install command writes to `/usr/local/bin/goss`.
72
+
73
+ ### Existing specs
74
+
75
+ Run the full spec suite (`bundle exec rake spec`) to confirm no regressions.
76
+
77
+ ## Acceptance Criteria
78
+
79
+ - [ ] `provision_commands` no longer references `goss.rocks/install`.
80
+ - [ ] `provision_commands` downloads Goss v0.4.9 directly from the GitHub releases page.
81
+ - [ ] The Goss binary is placed at `/usr/local/bin/goss` with execute permissions.
82
+ - [ ] `GOSS_VERSION` and `GOSS_DOWNLOAD_URL` are defined as constants on `CemAcpt::Provision::Linux`.
83
+ - [ ] `scan_provision_commands` is unchanged (no Goss installation in scan mode).
84
+ - [ ] All existing specs pass.
85
+ - [ ] New unit tests verify the download URL and absence of `goss.rocks`.
86
+
87
+ ## Files Touched
88
+
89
+ - `lib/cem_acpt/provision/terraform/linux.rb` — replace `curl | sh` with direct download; add `GOSS_VERSION` and `GOSS_DOWNLOAD_URL` constants.
90
+ - `spec/cem_acpt/provision/terraform/linux_spec.rb` — add tests for new Goss install command.
91
+ - `specifications/CEM-6827.md` — this file.
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cem_acpt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.12.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - puppetlabs
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-06-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: async-http
@@ -350,6 +349,7 @@ files:
350
349
  - specifications/CEM-6765.md
351
350
  - specifications/CEM-6798.md
352
351
  - specifications/CEM-6799.md
352
+ - specifications/CEM-6827.md
353
353
  homepage: https://github.com/puppetlabs/cem_acpt
354
354
  licenses:
355
355
  - proprietary
@@ -357,7 +357,6 @@ metadata:
357
357
  homepage_uri: https://github.com/puppetlabs/cem_acpt
358
358
  source_code_uri: https://github.com/puppetlabs/cem_acpt
359
359
  changelog_uri: https://github.com/puppetlabs/cem_acpt
360
- post_install_message:
361
360
  rdoc_options: []
362
361
  require_paths:
363
362
  - lib
@@ -372,8 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
372
371
  - !ruby/object:Gem::Version
373
372
  version: '0'
374
373
  requirements: []
375
- rubygems_version: 3.5.22
376
- signing_key:
374
+ rubygems_version: 3.6.9
377
375
  specification_version: 4
378
376
  summary: CEM Acceptance Tests
379
377
  test_files: []