summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Riteau <pierre@stackhpc.com>2018-10-19 14:22:05 +0100
committerPierre Riteau <pierre@stackhpc.com>2018-10-22 12:11:39 +0100
commitaab9f53b66c5f7cd4f02c8f48641c988066fd682 (patch)
tree05f61c70dbd269811cd19f4f736750d5123b58f7
parent4b20765f992a3685b5c47208f168f51c8d5354b3 (diff)
downloadironic-python-agent-aab9f53b66c5f7cd4f02c8f48641c988066fd682.tar.gz
Fix BMC IP address detection on CoreOS images3.3.1
On CoreOS images, IPA runs in a Debian Jessie chroot which uses mawk as its default awk implementation. However, mawk doesn't support POSIX character classes such as [:space:], which means get_bmc_address() fails to parse the BMC IP address from the output of ipmitool. This patch replaces the use of [[:space:]] by [ \t] which is equivalent for the purpose of parsing the output of ipmitool. Note that matching on tab characters is not strictly required as the packaged version of ipmitool only uses space characters, but is left in case tabs are used in other versions. Change-Id: I0e3306a4d4584ca28e03608e9f7270b770960a39 Story: #2004121 Task: #27571 (cherry picked from commit 8eecadb0a8a36eb541b96d6d2fcce12dbb121181)
-rw-r--r--ironic_python_agent/hardware.py2
-rw-r--r--releasenotes/notes/fix-bmc-ip-detection-for-coreos-483be0286593e393.yaml6
2 files changed, 7 insertions, 1 deletions
diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py
index 45414c6a..7d6c1676 100644
--- a/ironic_python_agent/hardware.py
+++ b/ironic_python_agent/hardware.py
@@ -1051,7 +1051,7 @@ class GenericHardwareManager(HardwareManager):
# types of communication media and protocols and effectively used
for channel in range(1, 8):
out, e = utils.execute(
- "ipmitool lan print {} | awk '/IP Address[[:space:]]*:/"
+ "ipmitool lan print {} | awk '/IP Address[ \\t]*:/"
" {{print $4}}'".format(channel), shell=True)
if e.startswith("Invalid channel"):
continue
diff --git a/releasenotes/notes/fix-bmc-ip-detection-for-coreos-483be0286593e393.yaml b/releasenotes/notes/fix-bmc-ip-detection-for-coreos-483be0286593e393.yaml
new file mode 100644
index 00000000..1a33130f
--- /dev/null
+++ b/releasenotes/notes/fix-bmc-ip-detection-for-coreos-483be0286593e393.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+ - |
+ Fixes detection of IPMI address in CoreOS-based images, by ensuring that
+ parsing of ``ipmitool`` output is compatible with the bundled
+ implementation of ``awk`` (``mawk``).