Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
[FEAT #118] WIP, tested host create comand
Browse files Browse the repository at this point in the history
  • Loading branch information
pcfe committed Dec 11, 2019
1 parent 0d34a46 commit 3a321a3
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion buildtestvms-from-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,39 @@ fi
### also disabled for now
exit 1

# for each host; dump Org, Loc and HG in a file, process that

for I in "${TEST_VM_LIST[@]}"
do
SUT_TMP_INFOFILE=$(mktemp)
ssh -q -l ${PUSH_USER} -i ${RSA_ID} ${SATELLITE} \
"hammer host info --id $I" | awk -F '[[:space:]][[:space:]]+' '$1~/^(Name|Organi[sz]ation|Host Group|Location)/ {print $1,$2}' > ${SUT_TMP_INFOFILE}
SUT_NAME=$(awk -F ': ' '$1~/^Name/ {print $2}' ${SUT_TMP_INFOFILE})
SUT_ORG=$(awk -F ': ' '$1~/^Organi[sz]ation/ {print $2}' ${SUT_TMP_INFOFILE})
SUT_HG_TITLE=$(awk -F ': ' '$1~/^Host Group/ {print $2}' ${SUT_TMP_INFOFILE})
SUT_LOC=$(awk -F ': ' '$1~/^Location/ {print $2}' ${SUT_TMP_INFOFILE})
rm -I ${SUT_TMP_INFOFILE}

inform "Deleting VM ID $I"
ssh -q -l ${PUSH_USER} -i ${RSA_ID} ${SATELLITE} \
"hammer host delete --id $I"

inform "Recreating VM ID $I"
ssh -q -l ${PUSH_USER} -i ${RSA_ID} ${SATELLITE} \
"hammer host create \
--name \"${SUT_NAME}\" \
--organization \"${SUT_ORG}\" \
--location \"${SUT_LOC}\" \
--hostgroup-title \"${SUT_HG_TITLE}\" \
--provision-method image \
--enabled true \
--managed true \
--compute-attributes=\"start=1\""

# do use
# --hostgroup-title "Test Servers/Jenkins pipeline SOE-CI/image-based"
# because that I can get from a hammer host info output
# hammer host info --name sattestclient05.sattest.pcfe.net|grep -e "^Organi[sz]ation" -e "^Host Group" -e "^Location"
hammer host create \
--name "kvm-test2" \
--organization "Sat Test" \
Expand Down

0 comments on commit 3a321a3

Please sign in to comment.