inventory_list=$(echo $inventory_list | sed 's/ $//')
for node in $inventory_list; do
- ((node_count++))
+ ((node_count+=1))
done
node_total=$node_count
"
node_count=0
for node in $inventory_list; do
- ((node_count++))
- node_output[$node]="
+ ((node_count+=1))
+ node_output="
{
\"pm_password\": \"$(eval echo \${${node}ipmi_pass})\",
\"pm_type\": \"pxe_ipmitool\",
\"pm_user\": \"$(eval echo \${${node}ipmi_user})\",
\"pm_addr\": \"$(eval echo \${${node}ipmi_ip})\"
"
- instack_env_output+=${node_output[$node]}
+ instack_env_output+=${node_output}
if [ $node_count -lt $node_total ]; then
instack_env_output+=" },"
else
'
#Copy instackenv.json to undercloud for baremetal
echo -e "{blue}Parsed instackenv JSON:\n${instack_env_output}${reset}"
- ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" <<EOI
+ ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
cat > instackenv.json << EOF
$instack_env_output
EOF
}
##verify vm exists, an has a dhcp lease assigned to it
-##params: none
+##params: none
function setup_instack_vm {
if ! virsh list --all | grep instack > /dev/null; then
#virsh vol-create default instack.qcow2.xml
# get the instack VM IP
UNDERCLOUD=$(grep instack /var/lib/libvirt/dnsmasq/default.leases | awk '{print $3}' | head -n 1)
- if -n $UNDERCLOUD; then
- echo "Never got IP for Instack. Can Not Continue."
+ if [ -z "$UNDERCLOUD" ]; then
+ echo "\n\nNever got IP for Instack. Can Not Continue."
exit 1
else
echo -e "${blue}\rInstack VM has IP $UNDERCLOUD${reset}"
sleep 3
CNT=$CNT-1
done
- if $CNT == 0; then
+ if [ "$CNT" -eq 0 ]; then
echo "Failed to contact Instack. Can Not Continue"
exit 1
fi
sleep 3
CNT=$CNT-1
done
- if $CNT == 0; then
+ if [ "$CNT" -eq 0 ]; then
echo "Failed to connect to Instack. Can Not Continue"
exit 1
fi