summaryrefslogtreecommitdiff
path: root/ironic_python_agent/netutils.py
diff options
context:
space:
mode:
authorBrad P. Crochet <brad@redhat.com>2019-06-07 12:11:08 -0400
committerDmitry Tantsur <dtantsur@protonmail.com>2019-06-12 13:00:21 +0000
commit7b3469ee0f2fbe21d807db88317187772ad2612d (patch)
tree3c2e2e715493ed73353eef1f8ced689dd9990b1c /ironic_python_agent/netutils.py
parent2e5fb1b5310534f79f704e0128ab46eccf55b30d (diff)
downloadironic-python-agent-7b3469ee0f2fbe21d807db88317187772ad2612d.tar.gz
Get the hostname of the introspected host
This will retrieve the hostname of the host being introspected, and return it as part of the introspection data. Change-Id: I54084251e1b0f3a40fe5ac760b2a7e45199c9fdb Story: #2005867 Task: #33674
Diffstat (limited to 'ironic_python_agent/netutils.py')
-rw-r--r--ironic_python_agent/netutils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ironic_python_agent/netutils.py b/ironic_python_agent/netutils.py
index 656e61ac..785e81d3 100644
--- a/ironic_python_agent/netutils.py
+++ b/ironic_python_agent/netutils.py
@@ -230,6 +230,13 @@ def get_mac_addr(interface_id):
return None
+# Other options...
+# 1. import os; os.uname()[1]
+# 2. import platform; platform.node()
+def get_hostname():
+ return socket.gethostname()
+
+
def interface_has_carrier(interface_name):
path = '/sys/class/net/{}/carrier'.format(interface_name)
try: