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:52 +0100
commitdc154a1652508d8631c43f44145bda03dcba5069 (patch)
treeeb12c95d379db9280b291a9118425526306cbb96
parentc6492f610c7ee72a29da97ffa9dbf221918f9e43 (diff)
downloadironic-python-agent-dc154a1652508d8631c43f44145bda03dcba5069.tar.gz
Fix BMC IP address detection on CoreOS images3.2.2
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 bd12a209..97a858c2 100644
--- a/ironic_python_agent/hardware.py
+++ b/ironic_python_agent/hardware.py
@@ -971,7 +971,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``).