don't update ipmi if there is no password

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2023-10-05 12:28:50 +02:00
committed by Jonathon Anderson
parent 37bf90c588
commit c23537e74a
2 changed files with 17 additions and 14 deletions

View File

@@ -90,6 +90,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
not have a device specified. #1154
- Return non-zero exit code on overlay sub-commands #1423
- Simplify passing of arguments to commands through `wwctl container exec`. #253
- Don't update IPMI if password isn't set. #638
## v4.5.8, 2024-10-01

View File

@@ -22,11 +22,6 @@ echo "IPMI IP address: $WWIPMI_IPADDR"
echo "IPMI netmask: $WWIPMI_NETMASK"
echo "IPMI gateway: $WWIPMI_GATEWAY"
echo "IPMI username: $WWIPMI_USER"
if test -n "$WWIPMI_PASSWORD"; then
echo "IPMI password is defined"
else
echo "IPMI password is undefined"
fi
modprobe ipmi_si
modprobe ipmi_ssif
@@ -58,18 +53,25 @@ if [ "$PREV_IP" != "$WWIPMI_IPADDR" -o "$PREV_NETMASK" != "$WWIPMI_NETMASK" -o "
fi
# User
if [ "$WWIPMI_USER" != "" ]; then
PREV_USER=$(ipmitool user list | grep "^2 " | awk '{ print $2; }')
TEST_PASSWORD=$(ipmitool user test 2 20 $WWIPMI_PASSWORD)
if [ "$WWIPMI_USER" != "$PREV_USER" -o "$TEST_PASSWORD" != "Success" ]; then
ipmitool user set name 2 $WWIPMI_USER
ipmitool user set password 2 $WWIPMI_PASSWORD
sleep 1
ipmitool user priv 2 4 1
ipmitool user enable 2
if test -n "$WWIPMI_PASSWORD"; then
echo "IPMI password is defined"
if [ "$WWIPMI_USER" != "" ]; then
PREV_USER=$(ipmitool user list | grep "^2 " | awk '{ print $2; }')
TEST_PASSWORD=$(ipmitool user test 2 20 $WWIPMI_PASSWORD)
if [ "$WWIPMI_USER" != "$PREV_USER" -o "$TEST_PASSWORD" != "Success" ]; then
ipmitool user set name 2 $WWIPMI_USER
ipmitool user set password 2 $WWIPMI_PASSWORD
sleep 1
ipmitool user priv 2 4 1
ipmitool user enable 2
fi
fi
else
echo "IPMI password is undefined"
exit
fi
# Authentication
#ipmitool lan set 1 auth user md5,password
#ipmitool lan set 1 auth operator md5,password