2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-21 16:39:32 +00:00

Fix identity image deployment of suse 15

The default 'cp' is /lbin/cp, but that fails, use full path to the cp that works.

Perform the hmac registration of api key that was missing.

Remove assumption that the ip will be ipv6, wrapping it only if a : is present in address.
This commit is contained in:
Jarrod Johnson
2026-08-04 12:45:52 -04:00
parent e05707da2e
commit 5dce6f2b21
@@ -31,7 +31,7 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then
echo "No cnflnt.yml found on CNFLNT_IDNT partition, ignoring"
else
idntdir=$(mktemp -d)
cp $tmnt/cnflnt.* $idntdir/
/usr/bin/cp $tmnt/cnflnt.* $idntdir/
fi
umount $tmnt
rmdir $tmnt
@@ -100,6 +100,17 @@ if [ ! -z "$idntdir" ]; then
echo MANAGER: $srv >> /etc/confluent/confluent.info
bootifidx=$(cat /sys/class/net/$nic/ifindex)
bootif=$(basename $nic)
hmackeyfile=/tmp/cnflnthmackeytmp
echo -n $(grep ^apitoken: $idntdir/cnflnt.yml|awk '{print $2}') > $hmackeyfile
passfile=/tmp/cnflnttmppassfile
passcrypt=/tmp/cnflntcryptfile
hmacfile=/tmp/cnflnthmacfile
ln -s /opt/confluent/bin/clortho /opt/confluent/bin/genpasshmac
/opt/confluent/bin/genpasshmac $passfile $passcrypt $hmacfile $hmackeyfile
if curl --capath /tls/ -f -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_CRYPTHMAC: $(cat $hmacfile)" -d@$passcrypt https://$srv/confluent-api/self/registerapikey; then
cp $passfile /etc/confluent/confluent.apikey
fi
fi
else
echo -n "Discovering confluent..."
@@ -114,6 +125,11 @@ else
done
nodename=$(grep ^NODENAME: /etc/confluent/confluent.info | head -n 1 | sed -e 's/NODENAME: //')
echo "done ($nodename)"
mgr=$(grep ^EXTMGRINFO: /etc/confluent/confluent.info |awk -F'|' '{print $1 " " $3}'|grep " 1$" | head -n 1 | awk '{print $2}')
if [ -z "$mgr" ]; then
mgr=$(grep ^MANAGER: /etc/confluent/confluent.info | head -n 1 | sed -e 's/MANAGER: //')
fi
/opt/confluent/bin/clortho $nodename $mgr > /etc/confluent/confluent.apikey
fi
echo "Hostname: $nodename" >> /etc/linuxrc.d/01-confluent
mgr=$(grep ^EXTMGRINFO: /etc/confluent/confluent.info |awk -F'|' '{print $1 " " $3}'|grep " 1$" | head -n 1 | awk '{print $2}')
@@ -132,8 +148,9 @@ fi
done
cd -
echo "NetDevice: $bootif" >> /etc/linuxrc.d/01-confluent
/opt/confluent/bin/clortho $nodename $mgr > /etc/confluent/confluent.apikey
mgr="[$mgr]"
if [[ "$mgr" == *":"* ]]; then
mgr="[$mgr]"
fi
if [ -z "$mgtiface" ]; then
curl -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $(cat /etc/confluent/confluent.apikey)" https://$mgr/confluent-api/self/deploycfg > /etc/confluent/confluent.deploycfg
else