output: ipmi_ip: 9.3.4.1
Signed-off-by: Zhang Yu 2134782174@qq.com --- tests/host-info | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/tests/host-info b/tests/host-info index a57855dc..5a4f590c 100755 --- a/tests/host-info +++ b/tests/host-info @@ -80,6 +80,24 @@ get_partitions() fi }
+get_ipmi_ip() +{ + # ipmitool lan print + # Set in Progress : Set Complete + # IP Address Source : Static Address + # IP Address : 9.3.4.1 + # Subnet Mask : 255.255.0.0 + # MAC Address : e0:00:84:2b:51:7b + # SNMP Community String : TrapAdmin12#$ + # IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10 + # Default Gateway IP : 9.3.0.1 + # 802.1q VLAN ID : Disabled + # RMCP+ Cipher Suites : 0,1,2,3,17 + # Cipher Suite Priv Max : XuuaXXXXXXXXXXX + imp_ip=$(ipmitool lan print |awk 'NR==3{print $4}') + [ $? -eq 0 ] && echo "ipmi_ip:" $imp_ip +} + main() { get_node @@ -87,6 +105,7 @@ main() get_partitions get_mac get_model_name + get_ipmi_ip }
main
On Tue, Oct 20, 2020 at 11:10:09AM +0800, Zhang Yu wrote:
output: ipmi_ip: 9.3.4.1
Signed-off-by: Zhang Yu 2134782174@qq.com
tests/host-info | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/tests/host-info b/tests/host-info index a57855dc..5a4f590c 100755 --- a/tests/host-info +++ b/tests/host-info @@ -80,6 +80,24 @@ get_partitions() fi }
+get_ipmi_ip() +{
- # ipmitool lan print
- # Set in Progress : Set Complete
- # IP Address Source : Static Address
- # IP Address : 9.3.4.1
- # Subnet Mask : 255.255.0.0
- # MAC Address : e0:00:84:2b:51:7b
- # SNMP Community String : TrapAdmin12#$
- # IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
- # Default Gateway IP : 9.3.0.1
- # 802.1q VLAN ID : Disabled
- # RMCP+ Cipher Suites : 0,1,2,3,17
- # Cipher Suite Priv Max : XuuaXXXXXXXXXXX
- imp_ip=$(ipmitool lan print |awk 'NR==3{print $4}')
- [ $? -eq 0 ] && echo "ipmi_ip:" $imp_ip
1: line 4: ipmitool: command not found ipmi_ip:
这是错误信息,可以验证imp_ip是否为空,让程序更健壮 Thanks sunyukui
+}
main() { get_node @@ -87,6 +105,7 @@ main() get_partitions get_mac get_model_name
- get_ipmi_ip
}
main
2.23.0
On Tue, Oct 20, 2020 at 11:55:26AM +0800, Sun Yukui wrote:
On Tue, Oct 20, 2020 at 11:10:09AM +0800, Zhang Yu wrote:
+get_ipmi_ip() +{
- # ipmitool lan print
- # Set in Progress : Set Complete
- # IP Address Source : Static Address
- # IP Address : 9.3.4.1
- # Subnet Mask : 255.255.0.0
- # MAC Address : e0:00:84:2b:51:7b
- # SNMP Community String : TrapAdmin12#$
- # IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
- # Default Gateway IP : 9.3.0.1
- # 802.1q VLAN ID : Disabled
- # RMCP+ Cipher Suites : 0,1,2,3,17
- # Cipher Suite Priv Max : XuuaXXXXXXXXXXX
- imp_ip=$(ipmitool lan print |awk 'NR==3{print $4}')
- [ $? -eq 0 ] && echo "ipmi_ip:" $imp_ip
1: line 4: ipmitool: command not found ipmi_ip: 这是错误信息,可以验证imp_ip是否为空,让程序更健壮
Look good, could you show me a example?
Thanks, Zhangyu
Thanks sunyukui
+}
main() { get_node @@ -87,6 +105,7 @@ main() get_partitions get_mac get_model_name
- get_ipmi_ip
}
main
2.23.0
On Tue, Oct 20, 2020 at 02:31:51PM +0800, Zhang Yu wrote:
On Tue, Oct 20, 2020 at 11:55:26AM +0800, Sun Yukui wrote:
On Tue, Oct 20, 2020 at 11:10:09AM +0800, Zhang Yu wrote:
+get_ipmi_ip() +{
- # ipmitool lan print
- # Set in Progress : Set Complete
- # IP Address Source : Static Address
- # IP Address : 9.3.4.1
- # Subnet Mask : 255.255.0.0
- # MAC Address : e0:00:84:2b:51:7b
- # SNMP Community String : TrapAdmin12#$
- # IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
- # Default Gateway IP : 9.3.0.1
- # 802.1q VLAN ID : Disabled
- # RMCP+ Cipher Suites : 0,1,2,3,17
- # Cipher Suite Priv Max : XuuaXXXXXXXXXXX
- imp_ip=$(ipmitool lan print |awk 'NR==3{print $4}')
- [ $? -eq 0 ] && echo "ipmi_ip:" $imp_ip
[ -n "$imp_ip" ] && echo $imp_ip
Thanks sunyukui
1: line 4: ipmitool: command not found ipmi_ip: 这是错误信息,可以验证imp_ip是否为空,让程序更健壮
Look good, could you show me a example? Thanks, Zhangyu
Thanks sunyukui
+}
main() { get_node @@ -87,6 +105,7 @@ main() get_partitions get_mac get_model_name
- get_ipmi_ip
}
main
2.23.0
On Tue, Oct 20, 2020 at 11:10:09AM +0800, Zhang Yu wrote:
output: ipmi_ip: 9.3.4.1
以上output太过平凡,去掉吧。
Signed-off-by: Zhang Yu 2134782174@qq.com
tests/host-info | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/tests/host-info b/tests/host-info index a57855dc..5a4f590c 100755 --- a/tests/host-info +++ b/tests/host-info @@ -80,6 +80,24 @@ get_partitions() fi }
+get_ipmi_ip() +{
- # ipmitool lan print
哪个是命令,哪个是output? 让人怎么区分?
- # Set in Progress : Set Complete
- # IP Address Source : Static Address
- # IP Address : 9.3.4.1
- # Subnet Mask : 255.255.0.0
- # MAC Address : e0:00:84:2b:51:7b
- # SNMP Community String : TrapAdmin12#$
- # IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
- # Default Gateway IP : 9.3.0.1
- # 802.1q VLAN ID : Disabled
- # RMCP+ Cipher Suites : 0,1,2,3,17
- # Cipher Suite Priv Max : XuuaXXXXXXXXXXX
- imp_ip=$(ipmitool lan print |awk 'NR==3{print $4}')
- [ $? -eq 0 ] && echo "ipmi_ip:" $imp_ip
+}
main() { get_node @@ -87,6 +105,7 @@ main() get_partitions get_mac get_model_name
- get_ipmi_ip
}
main
2.23.0
On Tue, Oct 20, 2020 at 11:10:09AM +0800, Zhang Yu wrote:
output: ipmi_ip: 9.3.4.1
Signed-off-by: Zhang Yu 2134782174@qq.com
tests/host-info | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/tests/host-info b/tests/host-info index a57855dc..5a4f590c 100755 --- a/tests/host-info +++ b/tests/host-info @@ -80,6 +80,24 @@ get_partitions() fi }
+get_ipmi_ip() +{
- # ipmitool lan print
- # Set in Progress : Set Complete
- # IP Address Source : Static Address
- # IP Address : 9.3.4.1
- # Subnet Mask : 255.255.0.0
- # MAC Address : e0:00:84:2b:51:7b
- # SNMP Community String : TrapAdmin12#$
- # IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
- # Default Gateway IP : 9.3.0.1
- # 802.1q VLAN ID : Disabled
- # RMCP+ Cipher Suites : 0,1,2,3,17
- # Cipher Suite Priv Max : XuuaXXXXXXXXXXX
- imp_ip=$(ipmitool lan print |awk 'NR==3{print $4}')
| awk 'NR==3 {print $4}'
Thanks, Jiaxin
- [ $? -eq 0 ] && echo "ipmi_ip:" $imp_ip
+}
main() { get_node @@ -87,6 +105,7 @@ main() get_partitions get_mac get_model_name
- get_ipmi_ip
}
main
2.23.0