If ipmitool returns error or empty, the return of "$(ipmitool lan print |grep -E "IP Address\s*:" | awk '{print $4}')" is null, and then only add the field
Signed-off-by: Zhang Yu 2134782174@qq.com --- tests/host-info | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tests/host-info b/tests/host-info index a57855dc..cd77c1eb 100755 --- a/tests/host-info +++ b/tests/host-info @@ -69,8 +69,7 @@ get_partitions() # sdf 1 ssd=$(lsblk -d -o name,ROTA |grep 0$ | awk '{print $1}') hdd=$(lsblk -d -o name,ROTA |grep 1$ | awk '{print $1}') - if [ -n "$hdd" ]; then - echo "hdd_partitions:" + if [ -n "$hdd" ]; then echo "hdd_partitions:" get_part $hdd fi
@@ -80,6 +79,11 @@ get_partitions() fi }
+get_ipmi_ip() +{ + echo "ipmi_ip: $(ipmitool lan print |grep -E "IP Address\s*:" | awk '{print $4}')" +} + main() { get_node @@ -87,6 +91,7 @@ main() get_partitions get_mac get_model_name + get_ipmi_ip }
main
Please ignore it.
On Fri, Oct 16, 2020 at 09:25:02AM +0800, Zhang Yu wrote:
If ipmitool returns error or empty, the return of "$(ipmitool lan print |grep -E "IP Address\s*:" | awk '{print $4}')" is null, and then only add the field
Signed-off-by: Zhang Yu 2134782174@qq.com
tests/host-info | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tests/host-info b/tests/host-info index a57855dc..cd77c1eb 100755 --- a/tests/host-info +++ b/tests/host-info @@ -69,8 +69,7 @@ get_partitions() # sdf 1 ssd=$(lsblk -d -o name,ROTA |grep 0$ | awk '{print $1}') hdd=$(lsblk -d -o name,ROTA |grep 1$ | awk '{print $1}')
- if [ -n "$hdd" ]; then
echo "hdd_partitions:"
- if [ -n "$hdd" ]; then echo "hdd_partitions:" get_part $hdd fi
@@ -80,6 +79,11 @@ get_partitions() fi }
+get_ipmi_ip() +{
- echo "ipmi_ip: $(ipmitool lan print |grep -E "IP Address\s*:" | awk '{print $4}')"
+}
main() { get_node @@ -87,6 +91,7 @@ main() get_partitions get_mac get_model_name
- get_ipmi_ip
}
main
2.23.0