Skip to content

Commit

Permalink
Fixes #32885: Remove puppet from foreman::user_groups if present
Browse files Browse the repository at this point in the history
The change theforeman/puppet-foreman#938
introduced dynamically determining if the puppet group needed to
be added to the foreman user. This no longer needs to be set
explicitly on the foreman::user_groups parameter thus the migration
cleans it up if present.
  • Loading branch information
ehelms committed Jul 12, 2021
1 parent b5391f5 commit a33ae3d
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if answers['foreman'].is_a?(Hash)
if answers['foreman']['user_groups'] && answers['foreman']['user_groups'].include?('puppet')
answers['foreman']['user_groups'].delete('puppet')
end
end
1 change: 0 additions & 1 deletion config/katello-answers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ foreman:
server_ssl_chain: /etc/pki/katello/certs/katello-server-ca.crt
server_ssl_crl: ""
server_ssl_key: /etc/pki/katello/private/katello-apache.key
user_groups: []
foreman::cli: true
foreman::cli::ansible: false
foreman::cli::azure: false
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if answers['foreman'].is_a?(Hash)
if answers['foreman']['user_groups'] && answers['foreman']['user_groups'].include?('puppet')
answers['foreman']['user_groups'].delete('puppet')
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
foreman:
user_groups: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
foreman:
user_groups: ['puppet']
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
foreman:
user_groups: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
foreman:
user_groups: ['puppet']
20 changes: 20 additions & 0 deletions spec/migration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,24 @@
end
end
end

%w[foreman katello].each do |scenario_name|
context "foreman drop puppet from user_groups" do
let(:answers_after) { load_fixture_yaml('cleanup-foreman-user-groups', "#{scenario_name}-answers-after.yaml") }
let(:scenario) do
{
:answers => load_fixture_yaml('cleanup-foreman-user-groups', "#{scenario_name}-answers-before.yaml"),
:config => load_config_yaml("#{scenario_name}.yaml"),
:migrations => config_path("#{scenario_name}.migrations"),
}
end

let(:migrator) { Kafo::Migrations.new(scenario[:migrations]).run(scenario[:config], scenario[:answers]) }

it 'changes scenario answers' do
_, after = migrator
expect(after).to include answers_after
end
end
end
end

0 comments on commit a33ae3d

Please sign in to comment.