Skip to content

Commit

Permalink
update pswi logs, fix pswi creation
Browse files Browse the repository at this point in the history
Signed-off-by: MarkAckert <[email protected]>
  • Loading branch information
MarkAckert committed Oct 31, 2024
1 parent f7c561d commit 2b322e1
Show file tree
Hide file tree
Showing 11 changed files with 427 additions and 470 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ jobs:
with:
name: pswi-folder
path: |
pswi/**
pswi/logs/**
- name: '[K8S] Build Kubernetes'
timeout-minutes: 10
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pswi-zowe-config-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ jobs:
pswi/**.txt
pswi/zowe_.yaml
pswi/ZWECONF1/**
pswi/logs/**
4 changes: 4 additions & 0 deletions pswi/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
logs/
EXP*
report.txt
unzipped/
301 changes: 143 additions & 158 deletions pswi/03_create.sh

Large diffs are not rendered by default.

134 changes: 64 additions & 70 deletions pswi/04_create_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#version=1.0

export BASE_URL="${ZOSMF_URL}:${ZOSMF_PORT}"
LOG_FILE=${LOGDIR}log_pswi_"`date +%y-%j-%H-%M-%S`"
LOG_FILE=$LOG_DIR/log_create_cleanup.txt

echo ""
echo ""
Expand All @@ -25,112 +25,106 @@ DELETE_SWI_URL="${BASE_URL}/zosmf/swmgmt/swi/${ZOSMF_SYSTEM}/${SWI_NAME}"
EXPORT_DSN_URL="${BASE_URL}/zosmf/restfiles/ds/${EXPORT_DSN}"
WORKFLOW_DSN_URL="${BASE_URL}/zosmf/restfiles/ds/${WORKFLOW_DSN}"

# JSONs
# JSONs
UNMOUNT_ZFS_JSON='{"action":"unmount"}'


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

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
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 [ "$RESP" != "" ]
then
echo "$RESP" >> $LOG_FILE
if [ $RESPCODE -ne 0 ]; then
echo "Info: Logging to file ${LOG_FILE}."
if [ "$RESP" != "" ]; then
echo "$RESP" >>$LOG_FILE
else
echo "REST API call wasn't successful." >> $LOG_FILE
fi
echo "REST API call wasn't successful." >>$LOG_FILE
fi
else
echo "REST API call was successful."
fi
return
}

return
}

# Create a log file
touch $LOG_FILE

# Delete the Software instance
echo 'Invoking REST API to delete the first Software Instance.'

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

# Delete data set with export jobs
echo "Invoking REST API to delete ${EXPORT_DSN} data set with export jobs."

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

# Delete
echo "Invoking REST API to delete ${WORKFLOW_DSN} data set."

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

# Unmount and delete
echo "Unmounting and deleting zFS ${TMP_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('${TMP_ZFS}') + " >> JCL
echo "IMMEDIATE" >> JCL
echo "/*" >> JCL
echo "//DELTZFST EXEC PGM=IDCAMS" >> JCL
echo "//SYSPRINT DD SYSOUT=*" >> JCL
echo "//SYSIN DD *" >> JCL
echo " DELETE ${TMP_ZFS}" >> JCL
echo "/*" >> JCL

sh scripts/submit_jcl.sh "`cat JCL`"
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('${TMP_ZFS}') + " >>JCL
echo "IMMEDIATE" >>JCL
echo "/*" >>JCL
echo "//DELTZFST EXEC PGM=IDCAMS" >>JCL
echo "//SYSPRINT DD SYSOUT=*" >>JCL
echo "//SYSIN DD *" >>JCL
echo " DELETE ${TMP_ZFS}" >>JCL
echo "/*" >>JCL

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
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

echo "Invoking REST API to unmount Zowe zFS ${ZOWE_ZFS} from its mountpoint."

RESP=`curl -s $ACTION_ZOWE_ZFS_URL -k -X "PUT" -d "$UNMOUNT_ZFS_JSON" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS`
RESP=$(curl -s $ACTION_ZOWE_ZFS_URL -k -X "PUT" -d "$UNMOUNT_ZFS_JSON" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS)
check_response "${RESP}" $?
Loading

0 comments on commit 2b322e1

Please sign in to comment.