diff options
| author | Jeff Carr <[email protected]> | 2024-01-06 14:23:19 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-06 14:23:19 -0600 |
| commit | ba3d5a3cb24429692a1d799e73a9d53cc798212e (patch) | |
| tree | 939c1a00155dfc69583bfba667730db6e13368bf /linuxstatus/hostname.go | |
| parent | 398d9fe3c44bdc8832fbf290beea7b6d13538f4b (diff) | |
more isolation of Update() pieces
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'linuxstatus/hostname.go')
| -rw-r--r-- | linuxstatus/hostname.go | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/linuxstatus/hostname.go b/linuxstatus/hostname.go index 6853ba6..08c7971 100644 --- a/linuxstatus/hostname.go +++ b/linuxstatus/hostname.go @@ -22,21 +22,8 @@ func (ls *LinuxStatus) GetDomainName() string { return me.domainname.Get() } -func (ls *LinuxStatus) setDomainName(dn string) { +func (ls *LinuxStatus) setDomainName() { if ! me.Ready() {return} - me.domainname.Set(dn) -} - -func lookupHostname() { - if ! me.Ready() {return} - var err error - var s string = "gui.Label == nil" - s, err = fqdn.FqdnHostname() - if (err != nil) { - log.Error(err, "FQDN hostname error") - return - } - log.Error(errors.New("full hostname should be: " + s)) dn := run("domainname") if me.window == nil { @@ -47,16 +34,44 @@ func lookupHostname() { } if (me.domainname.Get() != dn) { log.Log(CHANGE, "domainname has changed from", me.GetDomainName(), "to", dn) - me.setDomainName(dn) + me.domainname.Set(dn) me.changed = true } +} + +func (ls *LinuxStatus) GetHostShort() string { + if ! me.Ready() {return ""} + if me.window == nil { + log.Log(NOW, "me.window == nil") + } else { + log.Log(NOW, "me.window exists, but has not been drawn") + } + return me.hostshort.Get() +} +func (ls *LinuxStatus) setHostShort() { + if ! me.Ready() {return ""} hshort := run("hostname -s") if (me.hostshort.Get() != hshort) { log.Log(CHANGE, "hostname -s has changed from", me.hostshort.Get(), "to", hshort) me.hostshort.Set(hshort) me.changed = true } +} + +func lookupHostname() { + if ! me.Ready() {return} + var err error + var s string = "gui.Label == nil" + s, err = fqdn.FqdnHostname() + if (err != nil) { + log.Error(err, "FQDN hostname error") + return + } + log.Error(errors.New("full hostname should be: " + s)) + + me.setDomainName() + /* var test string |
