diff --git a/confluent_osdeploy/el8/initramfs/usr/lib/dracut/hooks/pre-trigger/01-confluent.sh b/confluent_osdeploy/el8/initramfs/usr/lib/dracut/hooks/pre-trigger/01-confluent.sh index 369b679d..198a5869 100644 --- a/confluent_osdeploy/el8/initramfs/usr/lib/dracut/hooks/pre-trigger/01-confluent.sh +++ b/confluent_osdeploy/el8/initramfs/usr/lib/dracut/hooks/pre-trigger/01-confluent.sh @@ -39,8 +39,9 @@ mkdir -p /etc/confluent echo -n > /etc/confluent/confluent.info umask $oum if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then - tmnt=$(mktemp -d) - tcfg=$(mktemp) + tmnt=/tmp/idntmnt + mkdir -p $tmnt + tcfg=/tmp/idnttmp mount /dev/disk/by-label/CNFLNT_IDNT $tmnt cd $tmnt deploysrvs=$(sed -n '/^deploy_servers:/, /^[^-]/p' cnflnt.yml |grep ^-|sed -e 's/^- //'|grep -v :) @@ -64,26 +65,27 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then /usr/libexec/nm-initrd-generator ip=$v4addr::$v4gw:$v4nm:$hostname::none fi NetworkManager --configure-and-quit=initrd --no-daemon - hmackeyfile=$(mktemp) + hmackeyfile=/tmp/cnflnthmackeytmp echo -n $(grep ^apitoken: cnflnt.yml|awk '{print $2}') > $hmackeyfile cd - umount $tmnt - passfile=$(mktemp) - passcrypt=$(mktemp) - hmacfile=$(mktemp) + 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 + echo 'NODENAME: '$nodename > /etc/confluent/confluent.info + for deploysrv in $deploysrvs; do + echo 'MANAGER: '$deploysrv >> /etc/confluent/confluent.info + done for deployer in $deploysrvs; do if curl -f -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_CRYPTHMAC: $(cat $hmacfile)" -d@$passcrypt -k https://$deployer/confluent-api/self/registerapikey; then cp $passfile /etc/confluent/confluent.apikey confluent_apikey=$(cat /etc/confluent/confluent.apikey) curl -sf -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $confluent_apikey" https://$deployer/confluent-api/self/deploycfg > /etc/confluent/confluent.deploycfg - curl -sf -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $confluent_apikey" https://$deployer/confluent-api/self/profileprivate/pending/config.ign > /config.ign - [ -s /config.ign ] || rm /config.ign confluent_profile=$(grep ^profile: /etc/confluent/confluent.deploycfg) confluent_profile=${confluent_profile#profile: } - curl -sf https://$deployer/confluent-public/os/$confluent_profile/rootfs.img | rdcore stream-hash /etc/coreos-live-want-rootfs | bsdtar -xf - -C / - exit 0 + break fi done fi