Skip to content

Commit a95378e

Browse files
Krisztian Horvathsodre90
Krisztian Horvath
authored andcommitted
CB-26382 Fail if the hostname or domain cannot be set
It can happen that the hostname or the domain cannot be set properly, but the Salt minion starts anyways and provides an incorrect minion ID for Cloudbreak. In this case the bootstrap process will eventually fail. To avoid this if the hostname or the domain set commands fail it will report a failure to Cloudbreak and it will retry again until is succeeds.
1 parent 9be06dd commit a95378e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ build-darwin:
5353
GOOS=darwin go build -a -installsuffix cgo ${LDFLAGS} -o build/Darwin_x86_64/${BINARY} main.go
5454

5555
build-linux:
56-
GOOS=linux go build -a -installsuffix cgo ${LDFLAGS} -o build/Linux_x86_64/${BINARY} main.go
56+
GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo ${LDFLAGS} -o build/Linux_x86_64/${BINARY} main.go
5757

5858
build-linux-arm64:
5959
GOOS=linux GOARCH=arm64 go build -a -installsuffix cgo ${LDFLAGS} -o build/Linux_arm64/${BINARY} main.go

saltboot/hostname.go

+3
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,19 @@ func ensureHostIsResolvable(customHostname *string, customDomain string, ipv4add
8282

8383
if err := updateHostsFile(hostName, domain, HOSTS_FILE, ipv4address); err != nil {
8484
log.Printf("[ensureHostIsResolvable] [ERROR] unable to update host file: %s", err.Error())
85+
return err
8586
}
8687
networkSysConfig := NETWORK_SYSCONFIG_FILE
8788
if isOs(os, SUSE, SLES12) {
8889
networkSysConfig = NETWORK_SYSCONFIG_FILE_SUSE
8990
}
9091
if err := updateSysConfig(hostName, domain, networkSysConfig); err != nil {
9192
log.Printf("[ensureHostIsResolvable] [ERROR] unable to update sys config: %s", err.Error())
93+
return err
9294
}
9395
if err := updateHostNameFile(hostName, HOSTNAME_FILE); err != nil {
9496
log.Printf("[ensureHostIsResolvable] [ERROR] unable to update host name: %s", err.Error())
97+
return err
9598
}
9699
return nil
97100
}

0 commit comments

Comments
 (0)