Fix BMC IP address detection on CoreOS images

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
This commit is contained in:
Pierre Riteau 2018-10-19 14:22:05 +01:00
parent c6ea17d413
commit 8eecadb0a8
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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``).