mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-05-06 21:52:54 +08:00
fix: always update hostname for rhel-like os (#23022)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -1029,10 +1029,10 @@ func (r *sRedhatLikeRootFs) DeployHostname(rootFs IDiskPartition, hn, domain str
|
|||||||
centosHn += "NETWORKING=yes\n"
|
centosHn += "NETWORKING=yes\n"
|
||||||
centosHn += fmt.Sprintf("HOSTNAME=%s\n", getHostname(hn, domain))
|
centosHn += fmt.Sprintf("HOSTNAME=%s\n", getHostname(hn, domain))
|
||||||
if err := rootFs.FilePutContents(sPath, centosHn, false, false); err != nil {
|
if err := rootFs.FilePutContents(sPath, centosHn, false, false); err != nil {
|
||||||
return err
|
return errors.Wrapf(err, "DeployHostname %s", sPath)
|
||||||
}
|
}
|
||||||
if rootFs.Exists("/etc/hostname", false) {
|
if err := rootFs.FilePutContents("/etc/hostname", hn, false, false); err != nil {
|
||||||
return rootFs.FilePutContents("/etc/hostname", hn, false, false)
|
return errors.Wrapf(err, "DeployHostname %s", "/etc/hostname")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user