Skip to content

Commit

Permalink
Update /etc/hosts on all nodes when hostname changes
Browse files Browse the repository at this point in the history
Fixes #227
  • Loading branch information
silug committed Dec 20, 2024
1 parent b35795b commit 4044bb5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.34.3 / 2024-12-20
* Fixed:
* Update /etc/hosts on all nodes when hostname changes (#227)

### 1.34.2 / 2024-12-19
* Fixed:
* Update /etc/hosts when hostname changes (#224)
Expand Down
13 changes: 8 additions & 5 deletions lib/simp/beaker_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ def linux_errata( suts )
if current_domain.nil? || current_domain.empty?
new_fqdn = hostname + '.beaker.test'

safe_sed(sut, "s/#{hostname}.*/#{new_fqdn} #{hostname}/", '/etc/hosts')
safe_sed(suts, "s/#{hostname}.*/#{new_fqdn} #{hostname}/", '/etc/hosts')

if !sut.which('hostnamectl').empty?
on(sut, "hostnamectl set-hostname #{new_fqdn}")
Expand Down Expand Up @@ -939,8 +939,13 @@ def rhel_rhsm_unsubscribe(suts)

# Apply known OS fixes we need to run Beaker on each SUT
def fix_errata_on( suts = hosts )
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
if is_windows?(sut)
windows_suts = suts.select { |sut| is_windows?(sut) }
linux_suts = suts - windows_suts

linux_errata(linux_suts) unless linux_suts.empty?

unless windows_suts.empty?
block_on(windows_suts, :run_in_parallel => @run_in_parallel) do |sut|
# Load the Windows requirements
require 'simp/beaker_helpers/windows'

Expand Down Expand Up @@ -971,8 +976,6 @@ def fix_errata_on( suts = hosts )
EOM

install_cert_on_windows(sut, 'geotrustglobal', geotrust_global_ca)
else
linux_errata(sut)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/simp/beaker_helpers/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
module Simp; end

module Simp::BeakerHelpers
VERSION = '1.34.2'
VERSION = '1.34.3'
end

0 comments on commit 4044bb5

Please sign in to comment.