Revision 5f30ea3f
b/lib/netutils.py | ||
---|---|---|
167 | 167 |
@param name: hostname or None |
168 | 168 |
|
169 | 169 |
""" |
170 |
self.name = self.GetNormalizedName(self.GetFqdn(name))
|
|
170 |
self.name = self.GetFqdn(name)
|
|
171 | 171 |
self.ip = self.GetIP(self.name, family=family) |
172 | 172 |
|
173 | 173 |
@classmethod |
... | ... | |
177 | 177 |
""" |
178 | 178 |
return cls.GetFqdn() |
179 | 179 |
|
180 |
@staticmethod
|
|
181 |
def GetFqdn(hostname=None): |
|
180 |
@classmethod
|
|
181 |
def GetFqdn(cls, hostname=None):
|
|
182 | 182 |
"""Return fqdn. |
183 | 183 |
|
184 | 184 |
If hostname is None the system's fqdn is returned. |
... | ... | |
192 | 192 |
if hostname is None: |
193 | 193 |
virtfqdn = vcluster.GetVirtualHostname() |
194 | 194 |
if virtfqdn: |
195 |
return virtfqdn
|
|
195 |
result = virtfqdn
|
|
196 | 196 |
else: |
197 |
return socket.getfqdn()
|
|
197 |
result = socket.getfqdn()
|
|
198 | 198 |
else: |
199 |
return socket.getfqdn(hostname) |
|
199 |
result = socket.getfqdn(hostname) |
|
200 |
|
|
201 |
return cls.GetNormalizedName(result) |
|
200 | 202 |
|
201 | 203 |
@staticmethod |
202 | 204 |
def GetIP(hostname, family=None): |
Also available in: Unified diff