Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users/muzikovam/pswi9 #4103

Merged
merged 17 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pswi/03_create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -293,17 +293,17 @@ echo "Showing EXPORT JCL how it looks before the change"
#else
echo "Changing jobcard and adding SYSAFF"
sed "s|//IZUD01EX JOB (ACCOUNT),'NAME'|$JOBST1\n$JOBST2|g" EXPORT >EXPJCL0
sed "s|//.*gimzipInputFile.*,|<FILEDEF name=\"ZWE.PSWI.AZWE003.ZFS\"|g" EXPJCL0 >EXPJCL1
sed "s|// FILEDATA=TEXT| archid=\"ZOS003.ZWE.PSWI.AZWE003.ZFS\"/>|g" EXPJCL1 >EXPJCL2
sed "s|// DD \*||g" EXPJCL2 >EXPJCL
#sed "s|//.*gimzipInputFile.*,|<FILEDEF name=\"ZWE.PSWI.AZWE003.ZFS\"|g" EXPJCL0 >EXPJCL1
#sed "s|// FILEDATA=TEXT| archid=\"ZOS003.ZWE.PSWI.AZWE003.ZFS\"/>|g" EXPJCL1 >EXPJCL2
#sed "s|// DD \*||g" EXPJCL2 >EXPJCL
# sed "s|ZOS003.ZWE.PSWI.|ZWE.PSWI.|g" EXPJCL3 >EXPJCL

#fi

sh scripts/submit_jcl.sh "$(cat EXPJCL)"
sh scripts/submit_jcl.sh "$(cat EXPJCL0)"
if [ $? -gt 0 ]; then exit -1; fi

rm ./EXPJCL
rm ./EXPJCL0
rm ./EXPORT

# Pax the directory
Expand Down Expand Up @@ -333,5 +333,4 @@ get ${SWI_NAME}.pax.Z
EOF
cd ../pswi

#TODO: redirect everything to $log/x ?
#TODO: Check why there is name in mountpoints responses and it still doesn't show (although the mount points are different so it's good it is not doing anything)
1 change: 0 additions & 1 deletion pswi/04_create_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ sh scripts/submit_jcl.sh "$(cat JCL)"
# Not checking results so the script doesn't fail
rm JCL


# Unmount and delete
echo "Unmounting and deleting zFS ${WORK_ZFS}."

Expand Down
3 changes: 2 additions & 1 deletion pswi/05_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ sh scripts/tmp_mounts.sh "${WORK_ZFS}" "${WORK_MOUNT}"
if [ $? -gt 0 ]; then exit -1; fi

# Run the deployment test
echo " Running the deployment test for z/OSMF version 2.3"
echo " Running the deployment test for z/OSMF version ${ZOSMF_V}"

pip install requests

python scripts/deploy_test_2_3.py
108 changes: 30 additions & 78 deletions pswi/06_test_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo "Portable Software Instance :" $PSWI
echo "Software instance name :" $DEPLOY_NAME
echo "Temporary zFS :" $TMP_ZFS
echo "Work zFS :" $WORK_ZFS # For z/OSMF v2.3
echo "Directory for logs :" $LOGDIR
echo "Directory for logs :" $LOG_DIR
echo "ACCOUNT :" $ACCOUNT
echo "SYSAFF :" $SYSAFF
echo "z/OSMF version :" $ZOSMF_V
Expand All @@ -25,52 +25,14 @@ DELETE_PSWI_URL="${BASE_URL}/zosmf/swmgmt/pswi/${ZOSMF_SYSTEM}/${PSWI}"
WORKFLOW_LIST_URL="${BASE_URL}/zosmf/workflow/rest/1.0/workflows?owner=${ZOSMF_USER}&workflowName=${WORKFLOW_NAME}.*"
DELETE_DEPL_SWI_URL="${BASE_URL}/zosmf/swmgmt/swi/${ZOSMF_SYSTEM}/${DEPLOY_NAME}"

check_response() {
RESP=$1
RESPCODE=$2

REASON=$(echo $RESP | grep -o '"reason":')
EMPTY=$(echo $RESP | grep -o '\[\]')
MSG=$(echo $RESP | grep -o '"messageText":')
if [ -n "$REASON" ] || [ -n "$MSG" ]; then
echo "Info: Logging to file ${LOG_FILE}."
echo "$RESP" >>$LOG_FILE
fi
if [ -n "$EMPTY" ]; then
echo "Info: Logging to file ${LOG_FILE}."
echo "$RESP" >>$LOG_FILE
fi
if [ $RESPCODE -ne 0 ]; then
echo "Info: Logging to file ${LOG_FILE}."
if [ -n "$RESP" ]; then
echo "$RESP" >>$LOG_FILE
else
echo "REST API call wasn't successful." >>$LOG_FILE
fi
else
echo "REST API call was successful."
fi

return
}

# Create a log file
touch $LOG_FILE

# Delete the Software instance
echo "Invoking REST API to delete the Software Instance created by deployment."

RESP=$(curl -s $DELETE_DEPL_SWI_URL -k -X "DELETE" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS)
check_response "${RESP}" $?

if [ "$ZOSMF_V" = "2.4" ]; then

# Delete the Portable Software Instance
echo "Invoking REST API to delete the portable software instance."

RESP=$(curl -s $DELETE_PSWI_URL -k -X "DELETE" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS)
check_response "${RESP}" $?
fi
sh scripts/check_response.sh "${RESP}" $?

# Unmount and delete
echo "Unmounting and deleting zFS ${TMP_ZFS}."
Expand All @@ -94,29 +56,7 @@ sh scripts/submit_jcl.sh "$(cat JCL)"
# Not checking results so the script doesn't fail
rm JCL

if [ "$ZOSMF_V" = "2.3" ]; then
# Unmount and delete
echo "Unmounting and deleting zFS ${WORK_ZFS}."

echo ${JOBST1} >JCL
echo ${JOBST2} >>JCL
echo "//UNMNTZFS EXEC PGM=IKJEFT01,REGION=4096K,DYNAMNBR=50" >>JCL
echo "//SYSTSPRT DD SYSOUT=*" >>JCL
echo "//SYSTSOUT DD SYSOUT=*" >>JCL
echo "//SYSTSIN DD * " >>JCL
echo "UNMOUNT FILESYSTEM('${WORK_ZFS}') + " >>JCL
echo "IMMEDIATE" >>JCL
echo "/*" >>JCL
echo "//DELTZFST EXEC PGM=IDCAMS" >>JCL
echo "//SYSPRINT DD SYSOUT=*" >>JCL
echo "//SYSIN DD *" >>JCL
echo " DELETE ${WORK_ZFS}" >>JCL
echo "/*" >>JCL

sh scripts/submit_jcl.sh "$(cat JCL)"
# Not checking results so the script doesn't fail
rm JCL
fi


# Unmount and delete
echo "Unmounting and deleting zFS ${TEST_HLQ}.ZFS."
Expand All @@ -127,13 +67,21 @@ echo "//UNMNTZFS EXEC PGM=IKJEFT01,REGION=4096K,DYNAMNBR=50" >>JCL
echo "//SYSTSPRT DD SYSOUT=*" >>JCL
echo "//SYSTSOUT DD SYSOUT=*" >>JCL
echo "//SYSTSIN DD * " >>JCL
echo "UNMOUNT FILESYSTEM('${TEST_HLQ}.ZFS.#') + " >>JCL
echo "IMMEDIATE" >>JCL
echo "/*" >>JCL
echo "//UNMNTZF2 EXEC PGM=IKJEFT01,REGION=4096K,DYNAMNBR=50" >>JCL
echo "//SYSTSPRT DD SYSOUT=*" >>JCL
echo "//SYSTSOUT DD SYSOUT=*" >>JCL
echo "//SYSTSIN DD * " >>JCL
echo "UNMOUNT FILESYSTEM('${TEST_HLQ}.ZFS') + " >>JCL
echo "IMMEDIATE" >>JCL
echo "/*" >>JCL
echo "//DELTZFST EXEC PGM=IDCAMS" >>JCL
echo "//SYSPRINT DD SYSOUT=*" >>JCL
echo "//SYSIN DD *" >>JCL
echo " DELETE ${TEST_HLQ}.ZFS" >>JCL
echo " DELETE ${TEST_HLQ}.ZFS.#" >>JCL
echo "/*" >>JCL

sh scripts/submit_jcl.sh "$(cat JCL)"
Expand All @@ -155,21 +103,25 @@ echo "/*" >>JCL
sh scripts/submit_jcl.sh "$(cat JCL)"
rm JCL

if [ "$ZOSMF_V" = "2.4" ]; then
# Delete Post-deployment workflow in z/OSMF
echo "Invoking REST API to delete Post-deployment workflows."

# Get workflowKey for Post-deployment workflow owned by user
RESP=$(curl -s $WORKFLOW_LIST_URL -k -X "GET" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS)
check_response "${RESP}" $?
WFKEYS=$(echo $RESP | sed 's/},/},\n/g' | grep -oP '"workflowKey":".*"' | cut -f4 -d\")

IFS=$'\n'
for KEY in $WFKEYS; do
# Unmount and delete
echo "Unmounting and deleting zFS ${WORK_ZFS}."

echo "Deleting a workflow."
RESP=$(curl -s ${BASE_URL}/zosmf/workflow/rest/1.0/workflows/${KEY} -k -X "DELETE" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS)
check_response "${RESP}" $?
echo ${JOBST1} >JCL
echo ${JOBST2} >>JCL
echo "//UNMNTZFS EXEC PGM=IKJEFT01,REGION=4096K,DYNAMNBR=50" >>JCL
echo "//SYSTSPRT DD SYSOUT=*" >>JCL
echo "//SYSTSOUT DD SYSOUT=*" >>JCL
echo "//SYSTSIN DD * " >>JCL
echo "UNMOUNT FILESYSTEM('${WORK_ZFS}') + " >>JCL
echo "IMMEDIATE" >>JCL
echo "/*" >>JCL
echo "//DELTZFST EXEC PGM=IDCAMS" >>JCL
echo "//SYSPRINT DD SYSOUT=*" >>JCL
echo "//SYSIN DD *" >>JCL
echo " DELETE ${WORK_ZFS}" >>JCL
echo "/*" >>JCL

done
fi
sh scripts/submit_jcl.sh "$(cat JCL)"
# Not checking results so the script doesn't fail
rm JCL
Loading
Loading