MCPcopy
hub / github.com/purpleidea/mgmt / HostnameRes

Struct HostnameRes

engine/resources/hostname.go:65–93  ·  view source on GitHub ↗

HostnameRes is a resource that allows setting and watching the hostname. If you don't specify any parameters, the Name is used. The Hostname field is used if none of the other parameters are used. If the parameters are set to the empty string, then those variants are not managed by the resource.

Source from the content-addressed store, hash-verified

63// used if none of the other parameters are used. If the parameters are set to
64// the empty string, then those variants are not managed by the resource.
65type HostnameRes struct {
66 traits.Base // add the base methods without re-implementation
67
68 init *engine.Init
69
70 // Hostname specifies the hostname we want to set in all of the places
71 // that it's possible. This is the fallback value for all the three
72 // fields below. If only this Hostname field is specified, this will set
73 // all tree fields (PrettyHostname, StaticHostname, TransientHostname)
74 // to this value.
75 Hostname string `lang:"hostname" yaml:"hostname"`
76
77 // PrettyHostname is a free-form UTF8 host name for presentation to the
78 // user.
79 PrettyHostname *string `lang:"pretty_hostname" yaml:"pretty_hostname"`
80
81 // StaticHostname is the one configured in /etc/hostname or a similar
82 // file. It is chosen by the local user. It is not always in sync with
83 // the current host name as returned by the gethostname() system call.
84 StaticHostname *string `lang:"static_hostname" yaml:"static_hostname"`
85
86 // TransientHostname is the one configured via the kernel's
87 // sethostbyname(). It can be different from the static hostname in case
88 // DHCP or mDNS have been configured to change the name based on network
89 // information.
90 TransientHostname *string `lang:"transient_hostname" yaml:"transient_hostname"`
91
92 conn *dbus.Conn
93}
94
95func (obj *HostnameRes) getHostname() string {
96 if obj.Hostname != "" {

Callers 1

UnmarshalYAMLMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected