Skip to content
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

Fix error when no domain is set #223

Merged
merged 1 commit into from
Dec 17, 2024
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.34.1 / 2024-12-17
* Fixed:
* Error when no domain is set (#222)

### 1.34.0 / 2024-09-17
* Fixed:
* Legacy fact usage
Expand Down
9 changes: 4 additions & 5 deletions lib/simp/beaker_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -723,10 +723,10 @@ def linux_errata( suts )
os_info = fact_on(sut, 'os')

# Make sure we have a domain on our host
current_domain = fact_on(sut, 'networking.domain').strip
current_domain = fact_on(sut, 'networking.domain')&.strip
hostname = fact_on(sut, 'networking.hostname').strip

if current_domain.empty?
if current_domain.nil? || current_domain.empty?
new_fqdn = hostname + '.beaker.test'

safe_sed(sut, 's/#{hostname}.*/#{new_fqdn} #{hostname}/', '/etc/hosts')
Expand All @@ -744,9 +744,8 @@ def linux_errata( suts )
end
end

if fact_on(sut, 'networking.domain').strip.empty?
fail("Error: hosts must have an FQDN, got domain='#{current_domain}'")
end
current_domain = fact_on(sut, 'networking.domain')&.strip
fail("Error: hosts must have an FQDN, got domain='#{current_domain}'") if current_domain.nil? || current_domain.empty?

# This may not exist in docker so just skip the whole thing
if sut.file_exist?('/etc/ssh')
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.0'
VERSION = '1.34.1'
end
Loading