Skip to content

Commit 1434ced

Browse files
authored
Fix error when no domain is set (#223)
Fixes #222
1 parent 0ff8bd5 commit 1434ced

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 1.34.1 / 2024-12-17
2+
* Fixed:
3+
* Error when no domain is set (#222)
4+
15
### 1.34.0 / 2024-09-17
26
* Fixed:
37
* Legacy fact usage

lib/simp/beaker_helpers.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,10 @@ def linux_errata( suts )
723723
os_info = fact_on(sut, 'os')
724724

725725
# Make sure we have a domain on our host
726-
current_domain = fact_on(sut, 'networking.domain').strip
726+
current_domain = fact_on(sut, 'networking.domain')&.strip
727727
hostname = fact_on(sut, 'networking.hostname').strip
728728

729-
if current_domain.empty?
729+
if current_domain.nil? || current_domain.empty?
730730
new_fqdn = hostname + '.beaker.test'
731731

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

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

751750
# This may not exist in docker so just skip the whole thing
752751
if sut.file_exist?('/etc/ssh')

lib/simp/beaker_helpers/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
module Simp; end
44

55
module Simp::BeakerHelpers
6-
VERSION = '1.34.0'
6+
VERSION = '1.34.1'
77
end

0 commit comments

Comments
 (0)