Skip to content

(CAT-2286) Remove puppet 7 infrastructure #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require:
AllCops:
NewCops: enable
DisplayCopNames: true
TargetRubyVersion: '2.6'
TargetRubyVersion: '3.1'
Include:
- "**/*.rb"
Exclude:
Expand Down
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ def location_for(place_or_version, fake_version = nil)
end

group :development do
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
Expand Down
2 changes: 1 addition & 1 deletion spec/tasks/lxd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
},
facts: {
provisioner: 'lxd',
container_id: container_id,
container_id:,
platform: lxd_platform
}
}
Expand Down
4 changes: 2 additions & 2 deletions spec/tasks/vagrant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
before(:each) do
# Stub $stdin.read to return a predefined JSON string
allow($stdin).to receive(:read).and_return({
platform: platform,
platform:,
action: 'provision',
vars: 'role: worker1',
inventory: tmpdir,
enable_synced_folder: 'true',
provider: provider,
provider:,
hyperv_vswitch: 'hyperv_vswitch',
hyperv_smb_username: 'hyperv_smb_username'
}.to_json)
Expand Down
8 changes: 4 additions & 4 deletions tasks/lxd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def provision

facts = {
provisioner: 'lxd',
container_id: container_id,
platform: platform
container_id:,
platform:
}

options.each do |option|
Expand All @@ -69,14 +69,14 @@ def provision
'shell-command': 'sh -lc'
}
},
facts: facts
facts:
}

node[:vars] = vars unless vars.nil?

inventory.add(node, 'lxd_nodes').save

{ status: 'ok', node_name: container_id, node: node }
{ status: 'ok', node_name: container_id, node: }
end

def tear_down
Expand Down
6 changes: 3 additions & 3 deletions tasks/provision_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def default_uri
def platform_to_cloud_request_parameters(platform, cloud, region, zone)
case platform
when String
{ cloud: cloud, region: region, zone: zone, images: [platform] }
{ cloud:, region:, zone:, images: [platform] }
when Array
{ cloud: cloud, region: region, zone: zone, images: platform }
{ cloud:, region:, zone:, images: platform }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this new syntax yeah

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, thats Ruby's 3.1+ recommended syntax. Rubocop safely autocorrected it

else
platform[:cloud] = cloud unless cloud.nil?
platform[:images] = [platform[:images]] if platform[:images].is_a?(String)
Expand Down Expand Up @@ -78,7 +78,7 @@ def invoke_cloud_request(params, uri, job_url, verb, retry_attempts)
body = response.body
body_json = false
end
puts({ _error: { kind: 'provision_service/service_error', msg: 'provision service returned an error', code: response.code, body: body, body_json: body_json } }.to_json)
puts({ _error: { kind: 'provision_service/service_error', msg: 'provision service returned an error', code: response.code, body:, body_json: } }.to_json)
exit 1
end
end
Expand Down
2 changes: 1 addition & 1 deletion tasks/update_node_pp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def update_file(manifest, target_node)
path = '/etc/puppetlabs/code/environments/production/manifests/nodes'
_stdout, stderr, status = Open3.capture3("mkdir -p #{path}")
raise Puppet::Error, _("stderr: ' %{stderr}')" % { stderr: stderr }) if status != 0
raise Puppet::Error, _("stderr: ' %{stderr}')" % { stderr: }) if status != 0

site_path = File.join(path, "#{target_node}.pp")
if File.file?(site_path)
Expand Down
2 changes: 1 addition & 1 deletion tasks/update_site_pp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def update_file(manifest)
path = '/etc/puppetlabs/code/environments/production/manifests'
_stdout, stderr, status = Open3.capture3("mkdir -p #{path}")
raise Puppet::Error, "stderr: ' %{stderr}')" % { stderr: stderr } if status != 0
raise Puppet::Error, "stderr: ' %{stderr}')" % ({ stderr: }) if status != 0

site_path = File.join(path, 'site.pp')
File.open(site_path, 'w+') { |f| f.write(manifest) }
Expand Down
4 changes: 2 additions & 2 deletions tasks/vagrant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def configure_remoting(platform, remoting_config_path, password)
ssh_params = {
port: remoting_config['port'],
keys: remoting_config['identityfile'],
password: password,
password:,
verbose: :debug
}.compact
Net::SSH.start(
Expand Down Expand Up @@ -192,7 +192,7 @@ def provision(platform, inventory, enable_synced_folder, provider, cpus, memory,
node['vars'] = var_hash
end
inventory.add(node, group_name).save
{ status: 'ok', node_name: node_name, node: node }
{ status: 'ok', node_name:, node: }
end

def tear_down(node_name, inventory)
Expand Down
Loading