Skip to content

Commit

Permalink
redo #595 + #607 + reduce parse console log
Browse files Browse the repository at this point in the history
Signed-off-by: John Davies <daviesja@uk.ibm.com>
  • Loading branch information
John-A-Davies committed Aug 29, 2019
1 parent 42c9485 commit 23fd6f5
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 80 deletions.
4 changes: 4 additions & 0 deletions scripts/configure/zowe-configure-scripts.sh
@@ -1,22 +1,26 @@
#Inject variables into zowe runtime scripts
sed -e "s#{{stc_name}}#${ZOWE_SERVER_PROCLIB_MEMBER}#" \
-e "s#{{zowe_prefix}}#${ZOWE_PREFIX}#" \
-e "s#{{zowe_instance}}#${ZOWE_INSTANCE}#" \
"${ZOWE_ROOT_DIR}/scripts/templates/zowe-start.template.sh" \
> "${ZOWE_ROOT_DIR}/scripts/zowe-start.sh"

sed -e "s#{{zowe_prefix}}#${ZOWE_PREFIX}#" \
-e "s#{{zowe_instance}}#${ZOWE_INSTANCE}#" \
"${ZOWE_ROOT_DIR}/scripts/templates/zowe-stop.template.sh" \
> "${ZOWE_ROOT_DIR}/scripts/zowe-stop.sh"

sed -e "s#{{java_home}}#${ZOWE_JAVA_HOME}#" \
-e "s#{{node_home}}#${NODE_HOME}#" \
-e "s#{{zowe_prefix}}#${ZOWE_PREFIX}#" \
-e "s#{{zowe_instance}}#${ZOWE_INSTANCE}#" \
-e "s#{{stc_name}}#${ZOWE_SERVER_PROCLIB_MEMBER}#" \
"${ZOWE_ROOT_DIR}/scripts/templates/zowe-support.template.sh" \
> "${ZOWE_ROOT_DIR}/scripts/zowe-support.sh"

sed -e "s#{{node_home}}#${NODE_HOME}#" \
-e "s#{{zowe_prefix}}#${ZOWE_PREFIX}#" \
-e "s#{{zowe_instance}}#${ZOWE_INSTANCE}#" \
"${ZOWE_ROOT_DIR}/scripts/templates/run-zowe.template.sh" \
> "${ZOWE_ROOT_DIR}/scripts/internal/run-zowe.sh"

Expand Down
39 changes: 19 additions & 20 deletions scripts/configure/zowe-configure.sh
Expand Up @@ -66,7 +66,7 @@ fi
zluxserverdirectory='zlux-app-server'
echo "Preparing folder permission for zLux plugins foder..." >> $LOG_FILE
chmod -R u+w $ZOWE_ROOT_DIR/$zluxserverdirectory/plugins/
chmod -R u+w $ZOWE_ROOT_DIR/$zluxserverdirectory/deploy/site

# TODO LATER - revisit to work out the best permissions, but currently needed so deploy.sh can run
chmod -R 775 $ZOWE_ROOT_DIR/zlux-app-server/deploy/product
chmod -R 775 $ZOWE_ROOT_DIR/zlux-app-server/deploy/instance
Expand All @@ -75,6 +75,23 @@ cd $ZOWE_ROOT_DIR/zlux-build
chmod a+x deploy.sh
./deploy.sh > /dev/null

# TODO LATER - same as the above - zss won't start with those permissions,
sed -e "s#{{root_dir}}#${ZOWE_ROOT_DIR}#" \
"$ZOWE_ROOT_DIR/scripts/templates/zowe-runtime-authorize.template.sh" \
> "$ZOWE_ROOT_DIR/scripts/zowe-runtime-authorize.sh"

chmod a+x $ZOWE_ROOT_DIR/scripts/zowe-runtime-authorize.sh
$(. $ZOWE_ROOT_DIR/scripts/zowe-runtime-authorize.sh)
AUTH_RETURN_CODE=$?
if [[ $AUTH_RETURN_CODE == "0" ]]; then
echo " The permissions were successfully changed"
echo " zowe-runtime-authorize.sh run successfully" >> $LOG_FILE
else
echo " The current user does not have sufficient authority to modify all the file and directory permissions."
echo " A user with sufficient authority must run $ZOWE_ROOT_DIR/scripts/zowe-runtime-authorize.sh"
echo " zowe-runtime-authorize.sh failed to run successfully" >> $LOG_FILE
fi

# Configure API Mediation layer. Because this script may fail because of priviledge issues with the user ID
# this script is run after all the folders have been created and paxes expanded above
echo "Attempting to setup Zowe API Mediation Layer certificates ... "
Expand All @@ -90,6 +107,7 @@ echo "Attempting to setup Zowe Scripts ... "
sed -e "s#{{java_home}}#${ZOWE_JAVA_HOME}#" \
-e "s#{{node_home}}#${NODE_HOME}#" \
-e "s#{{zowe_prefix}}#${ZOWE_PREFIX}#" \
-e "s#{{zowe_instance}}#${ZOWE_INSTANCE}#" \
-e "s#{{stc_name}}#${ZOWE_SERVER_PROCLIB_MEMBER}#" \
-e "s#{{root_dir}}#${ZOWE_ROOT_DIR}#" \
"${ZOWE_ROOT_DIR}/scripts/templates/zowe-support.template.sh" \
Expand All @@ -99,25 +117,6 @@ chmod a+x "${ZOWE_ROOT_DIR}/scripts/zowe-support.sh"
echo "Attempting to setup Zowe Proclib ... "
. $CONFIG_DIR/zowe-configure-proclib.sh

# TODO LATER - same as the above - zss won't start with those permissions,
sed -e "s#{{root_dir}}#${ZOWE_ROOT_DIR}#" \
-e "s#{{zosmf_admin_group}}#${ZOWE_ZOSMF_ADMIN_GROUP}#" \
-e "s#{{configure_log_file}}#${LOG_FILE}#" \
"$ZOWE_ROOT_DIR/scripts/templates/zowe-runtime-authorize.template.sh" \
> "$ZOWE_ROOT_DIR/scripts/zowe-runtime-authorize.sh"

chmod a+x $ZOWE_ROOT_DIR/scripts/zowe-runtime-authorize.sh
$(. $ZOWE_ROOT_DIR/scripts/zowe-runtime-authorize.sh)
AUTH_RETURN_CODE=$?
if [[ $AUTH_RETURN_CODE == "0" ]]; then
echo " The permissions were successfully changed"
echo " zowe-runtime-authorize.sh run successfully" >> $LOG_FILE
else
echo " The current user does not have sufficient authority to modify all the file and directory permissions."
echo " A user with sufficient authority must run $ZOWE_ROOT_DIR/scripts/zowe-runtime-authorize.sh"
echo " zowe-runtime-authorize.sh failed to run successfully" >> $LOG_FILE
fi

cd $PREV_DIR

echo "To start Zowe run the script "$ZOWE_ROOT_DIR/scripts/zowe-start.sh
Expand Down
20 changes: 10 additions & 10 deletions scripts/run-zowe.template.sh
Expand Up @@ -19,16 +19,16 @@
#
#export "NODE_PATH='"$ZOWE_ROOT_DIR"/zlux-app-server/bin':$NODE_PATH"

export ZOWE_PREFIX={{zowe_prefix}}
ZOWE_API_GW=${ZOWE_PREFIX}AGW1
ZOWE_API_DS=${ZOWE_PREFIX}ADS1
ZOWE_API_CT=${ZOWE_PREFIX}AAC1
ZOWE_DESKTOP=${ZOWE_PREFIX}D1
ZOWE_EXPL_JOBS=${ZOWE_PREFIX}EAJ1
ZOWE_EXPL_DATA=${ZOWE_PREFIX}EAD1
ZOWE_EXPL_UI_JES=${ZOWE_PREFIX}EUJ1
ZOWE_EXPL_UI_MVS=${ZOWE_PREFIX}EUD1
ZOWE_EXPL_UI_USS=${ZOWE_PREFIX}EUU1
export ZOWE_PREFIX={{zowe_prefix}}{{zowe_instance}}
ZOWE_API_GW=${ZOWE_PREFIX}AG
ZOWE_API_DS=${ZOWE_PREFIX}AD
ZOWE_API_CT=${ZOWE_PREFIX}AC
ZOWE_DESKTOP=${ZOWE_PREFIX}DT
ZOWE_EXPL_JOBS=${ZOWE_PREFIX}EJ
ZOWE_EXPL_DATA=${ZOWE_PREFIX}ED
ZOWE_EXPL_UI_JES=${ZOWE_PREFIX}UJ
ZOWE_EXPL_UI_MVS=${ZOWE_PREFIX}UD
ZOWE_EXPL_UI_USS=${ZOWE_PREFIX}UU

if [[ ! -f $NODE_HOME/"./bin/node" ]]
then
Expand Down
75 changes: 31 additions & 44 deletions scripts/zowe-parse-yaml.sh
Expand Up @@ -51,6 +51,12 @@ do
ZOWE_PREFIX=$value
export ZOWE_PREFIX
fi
# Look for instance= beneath install:
if [[ $key == "instance" ]] && [[ $section == "install" ]]
then
ZOWE_INSTANCE=$value
export ZOWE_INSTANCE
fi
# Look for jobsAPIPort= beneath zos-services:
if [[ $key == "jobsAPIPort" ]] && [[ $section == "zos-services" ]]
then
Expand All @@ -75,12 +81,6 @@ do
ZOWE_ZSS_SERVER_PORT=$value
export ZOWE_ZSS_SERVER_PORT
fi
# Look for privilegedServerName= beneath zlux-server:
if [[ $key == "zssCrossMemoryServerName" ]] && [[ $section == "zlux-server" ]]
then
ZOWE_ZSS_XMEM_SERVER_NAME=$value
export ZOWE_ZSS_XMEM_SERVER_NAME
fi
# Look for sshPort= beneath terminals:
if [[ $key == "sshPort" ]] && [[ $section == "terminals" ]]
then
Expand Down Expand Up @@ -163,17 +163,11 @@ do
ZOWE_ZOSMF_KEYRING=$value
export ZOWE_ZOSMF_KEYRING
fi

if [[ $key == "zosmfUserid" ]] && [[ $section == "zosmf" ]]
if [[ $key == "zosmfUserid" ]] && [[ $section == "api-mediation" ]]
then
ZOWE_ZOSMF_USERID=$value
export ZOWE_ZOSMF_USERID
fi
if [[ $key == "zosmfAdminGroup" ]] && [[ $section == "zosmf" ]]
then
ZOWE_ZOSMF_ADMIN_GROUP=$value
export ZOWE_ZOSMF_ADMIN_GROUP
fi

if [[ $key == "dsName" ]] && [[ $section == "zowe-server-proclib" ]]
then
Expand All @@ -196,92 +190,87 @@ parseConfiguationFile ./zowe-install.yaml
if [[ $ZOWE_ROOT_DIR == "" ]]
then
ZOWE_ROOT_DIR="~/zowe/$ZOWE_VERSION"
echo " ZOWE_ROOT_DIR not specified: Defaulting to ~/zowe/$ZOWE_VERSION"
echo " ZOWE_ROOT_DIR not specified: Defaulting to ~/zowe/$ZOWE_VERSION" >> $LOG_FILE
fi
if [[ $ZOWE_PREFIX == "" ]]
then
ZOWE_PREFIX="ZOWE"
echo " ZOWE_PREFIX not specified: Defaulting to ZOWE"
echo " ZOWE_PREFIX not specified: Defaulting to ZOWE" >> $LOG_FILE
fi
if [[ $ZOWE_INSTANCE == "" ]]
then
ZOWE_INSTANCE="1"
echo " ZOWE_INSTANCE not specified: Defaulting to 1" >> $LOG_FILE
fi
if [[ $ZOWE_EXPLORER_SERVER_JOBS_PORT == "" ]]
then
ZOWE_EXPLORER_SERVER_JOBS_PORT=7080
echo " ZOWE_EXPLORER_SERVER_JOBS_PORT not specified: Defaulting to 7080"
echo " ZOWE_EXPLORER_SERVER_JOBS_PORT not specified: Defaulting to 7080" >> $LOG_FILE
fi
if [[ $ZOWE_EXPLORER_SERVER_DATASETS_PORT == "" ]]
then
ZOWE_EXPLORER_SERVER_DATASETS_PORT=8547
echo " ZOWE_EXPLORER_SERVER_DATASETS_PORT not specified: Defaulting to 8547"
echo " ZOWE_EXPLORER_SERVER_DATASETS_PORT not specified: Defaulting to 8547" >> $LOG_FILE
fi
if [[ $ZOWE_ZLUX_SERVER_HTTPS_PORT == "" ]]
then
ZOWE_ZLUX_SERVER_HTTPS_PORT=8544
echo " ZOWE_ZLUX_SERVER_HTTPS_PORT not specified: Defaulting to 8544"
echo " ZOWE_ZLUX_SERVER_HTTPS_PORT not specified: Defaulting to 8544" >> $LOG_FILE
fi
if [[ $ZOWE_ZSS_SERVER_PORT == "" ]]
then
ZOWE_ZSS_SERVER_PORT=8542
echo " ZOWE_ZSS_SERVER_PORT not specified: Defaulting to 8542"
fi
if [[ $ZOWE_ZSS_XMEM_SERVER_NAME == "" ]]
then
ZOWE_ZSS_XMEM_SERVER_NAME=ZWESIS_STD
echo " ZOWE_ZSS_XMEM_SERVER_NAME not specified: Defaulting to ZWESIS_STD"
echo " ZOWE_ZSS_SERVER_PORT not specified: Defaulting to 8542" >> $LOG_FILE
fi
if [[ $ZOWE_EXPLORER_JES_UI_PORT == "" ]]
then
ZOWE_EXPLORER_JES_UI_PORT=8546
echo " ZOWE_EXPLORER_JES_UI_PORT not specified: Defaulting to 8546"
ZOWE_ZSS_SERVER_PORT=8546
echo " ZOWE_EXPLORER_JES_UI_PORT not specified: Defaulting to 8546" >> $LOG_FILE
fi
if [[ $ZOWE_EXPLORER_MVS_UI_PORT == "" ]]
then
ZOWE_EXPLORER_MVS_UI_PORT=8548
echo " ZOWE_EXPLORER_MVS_UI_PORT not specified: Defaulting to 8548"
echo " ZOWE_EXPLORER_MVS_UI_PORT not specified: Defaulting to 8548" >> $LOG_FILE
fi
if [[ $ZOWE_EXPLORER_USS_UI_PORT == "" ]]
then
ZOWE_EXPLORER_USS_UI_PORT=8550
echo " ZOWE_EXPLORER_USS_UI_PORT not specified: Defaulting to 8550"
echo " ZOWE_EXPLORER_USS_UI_PORT not specified: Defaulting to 8550" >> $LOG_FILE
fi
if [[ $ZOWE_APIM_CATALOG_PORT == "" ]]
then
ZOWE_APIM_CATALOG_PORT=7552
echo " ZOWE_APIM_CATALOG_PORT not specified: Defaulting to 7552"
echo " ZOWE_APIM_CATALOG_PORT not specified: Defaulting to 7552" >> $LOG_FILE
fi
if [[ $ZOWE_APIM_DISCOVERY_PORT == "" ]]
then
ZOWE_APIM_DISCOVERY_PORT=7553
echo " ZOWE_APIM_DISCOVERY_PORT not specified: Defaulting to 7553"
echo " ZOWE_APIM_DISCOVERY_PORT not specified: Defaulting to 7553" >> $LOG_FILE
fi
if [[ $ZOWE_APIM_GATEWAY_PORT == "" ]]
then
ZOWE_APIM_GATEWAY_PORT=7554
echo " ZOWE_APIM_GATEWAY_PORT not specified: Defaulting to 7554"
echo " ZOWE_APIM_GATEWAY_PORT not specified: Defaulting to 7554" >> $LOG_FILE
fi
if [[ $ZOWE_APIM_VERIFY_CERTIFICATES == "" ]]
then
ZOWE_APIM_VERIFY_CERTIFICATES="true"
echo " ZOWE_APIM_VERIFY_CERTIFICATES not specified: Defaulting to true"
echo " ZOWE_APIM_VERIFY_CERTIFICATES not specified: Defaulting to true" >> $LOG_FILE
fi
if [[ $ZOWE_APIM_ENABLE_SSO == "" ]]
then
ZOWE_APIM_ENABLE_SSO="false"
echo " ZOWE_APIM_ENABLE_SSO not specified: Defaulting to false"
echo " ZOWE_APIM_ENABLE_SSO not specified: Defaulting to false" >> $LOG_FILE
fi
if [[ $ZOWE_ZOSMF_KEYRING == "" ]]
then
ZOWE_ZOSMF_KEYRING="IZUKeyring.IZUDFLT"
echo " ZOWE_ZOSMF_KEYRING not specified: Defaulting to IZUKeyring.IZUDFLT"
echo " ZOWE_ZOSMF_KEYRING not specified: Defaulting to IZUKeyring.IZUDFLT" >> $LOG_FILE
fi
if [[ $ZOWE_ZOSMF_USERID == "" ]]
then
ZOWE_ZOSMF_USERID="IZUSVR"
echo " ZOWE_ZOSMF_USERID not specified: Defaulting to IZUSVR"
fi
if [[ $ZOWE_ZOSMF_ADMIN_GROUP == "" ]]
then
ZOWE_ZOSMF_ADMIN_GROUP="IZUADMIN"
echo " ZOWE_ZOSMF_ADMIN_GROUP not specified: Defaulting to IZUADMIN"
echo " ZOWE_ZOSMF_USERID not specified: Defaulting to IZUSVR" >> $LOG_FILE
fi

# Do not echo the ssh and terminal ports because unlike the others, that Zowe needs free to alllocate and use
Expand All @@ -298,12 +287,12 @@ fi
if [[ $ZOWE_SERVER_PROCLIB_MEMBER == "" ]]
then
ZOWE_SERVER_PROCLIB_MEMBER=ZOWESVR
echo " ZOWE_SERVER_PROCLIB_MEMBER not specified: Defaulting to ZOWESVR"
echo " ZOWE_SERVER_PROCLIB_MEMBER not specified: Defaulting to ZOWESVR" >> $LOG_FILE
fi
if [[ $ZOWE_SERVER_PROCLIB_DSNAME == "" ]]
then
ZOWE_SERVER_PROCLIB_DSNAME=auto
echo " ZOWE_SERVER_PROCLIB_DSNAME not specified: PROCLIB DSNAME will be selected automatically"
echo " ZOWE_SERVER_PROCLIB_DSNAME not specified: PROCLIB DSNAME will be selected automatically" >> $LOG_FILE
fi

echo " ZOWE_ROOT_DIR="$ZOWE_ROOT_DIR >> $LOG_FILE
Expand All @@ -312,7 +301,6 @@ echo " ZOWE_ZLUX_SERVER_HTTPS_PORT="$ZOWE_ZLUX_SERVER_HTTPS_PORT >> $LOG_FILE
echo " ZOWE_EXPLORER_SERVER_JOBS_PORT="$ZOWE_EXPLORER_SERVER_JOBS_PORT >> $LOG_FILE
echo " ZOWE_EXPLORER_SERVER_DATASETS_PORT="$ZOWE_EXPLORER_SERVER_DATASETS_PORT >> $LOG_FILE
echo " ZOWE_ZSS_SERVER_PORT="$ZOWE_ZSS_SERVER_PORT >> $LOG_FILE
echo " ZOWE_ZSS_XMEM_SERVER_NAME="$ZOWE_ZSS_XMEM_SERVER_NAME >> $LOG_FILE
echo " ZOWE_ZLUX_SSH_PORT="$ZOWE_ZLUX_SSH_PORT >> $LOG_FILE
echo " ZOWE_ZLUX_TELNET_PORT="$ZOWE_ZLUX_TELNET_PORT >> $LOG_FILE
echo " ZOWE_EXPLORER_JES_UI_PORT="$ZOWE_EXPLORER_JES_UI_PORT >> $LOG_FILE
Expand All @@ -329,7 +317,6 @@ echo " ZOWE_APIM_VERIFY_CERTIFICATES="$ZOWE_APIM_VERIFY_CERTIFICATES >> $LOG_FI
echo " ZOWE_APIM_ENABLE_SSO="$ZOWE_APIM_ENABLE_SSO >> $LOG_FILE
echo " ZOWE_ZOSMF_KEYRING="$ZOWE_ZOSMF_KEYRING >> $LOG_FILE
echo " ZOWE_ZOSMF_USERID="$ZOWE_ZOSMF_USERID >> $LOG_FILE
echo " ZOWE_ZOSMF_ADMIN_GROUP="$ZOWE_ZOSMF_ADMIN_GROUP >> $LOG_FILE
echo " ZOWE_APIM_CATALOG_HTTP_PORT="$ZOWE_APIM_CATALOG_HTTP_PORT >> $LOG_FILE
echo " ZOWE_APIM_DISCOVERY_HTTP_PORT="$ZOWE_APIM_DISCOVERY_HTTP_PORT >> $LOG_FILE
echo " ZOWE_APIM_GATEWAY_HTTPS_PORT="$ZOWE_APIM_GATEWAY_HTTPS_PORT >> $LOG_FILE
Expand Down
2 changes: 1 addition & 1 deletion scripts/zowe-start.template.sh
Expand Up @@ -15,5 +15,5 @@ VAR=`dirname $0` # Obtain the scripts directory name
cd $VAR/.. # Change to its parent which should be ZOWE_ROOT_DIR
ZOWE_ROOT_DIR=`pwd` # Set our environment variable
$ZOWE_ROOT_DIR/scripts/internal/opercmd \
"S {{stc_name}},SRVRPATH='"$ZOWE_ROOT_DIR"'",JOBNAME={{zowe_prefix}}SV1
"S {{stc_name}},SRVRPATH='"$ZOWE_ROOT_DIR"'",JOBNAME={{zowe_prefix}}{{zowe_instance}}SV
echo Start command issued, check SDSF job log ...
2 changes: 1 addition & 1 deletion scripts/zowe-stop.template.sh
Expand Up @@ -15,4 +15,4 @@ VAR=`dirname $0` # Obtain the scripts directory name
cd $VAR/.. # Change to its parent which should be ZOWE_ROOT_DIR
ZOWE_ROOT_DIR=`pwd` # Set our environment variable
echo Stopping ZOWE server
$ZOWE_ROOT_DIR/scripts/internal/opercmd "c {{zowe_prefix}}SV1"
$ZOWE_ROOT_DIR/scripts/internal/opercmd "c {{zowe_prefix}}{{zowe_instance}}SV"
11 changes: 7 additions & 4 deletions scripts/zowe-support.template.sh
Expand Up @@ -4,7 +4,7 @@
VAR=`dirname $0` # Obtain the scripts directory name
cd $VAR/.. # Change to its parent which should be ZOWE_ROOT_DIR
ZOWE_ROOT_DIR={{root_dir}} # Set our environment variable
ZOWE_PREFIX={{zowe_prefix}}
ZOWE_PREFIX={{zowe_prefix}}{{zowe_instance}}
ZOWE_INSTALL_LOG_DIR=${ZOWE_ROOT_DIR}/install_log/
ZOWE_CONFIGURE_LOG_DIR=${ZOWE_ROOT_DIR}/configure_log/
ZOWE_INSTALL_ZLUX_SERVER_LOG=${ZOWE_ROOT_DIR}/zlux-app-server/log/
Expand Down Expand Up @@ -40,7 +40,10 @@ if [[ -z "${ZOWE_PREFIX}" ]];then
echo "The ZOWE_PREFIX environment variable wasn't properly populated during install. Exiting."
exit
fi

if [[ -z "${ZOWE_INSTANCE}" ]];then
echo "The ZOWE_INSTANCE environment variable wasn't properly populated during install. Exiting."
exit
fi
# Function Definition
# Not really sure if we should use this, it takes a lot of time to search in directory tree
# Alternative is to count on the directory structure, and assume that needed files are there
Expand Down Expand Up @@ -111,8 +114,8 @@ write_to_log "Collecting manifest.json"
add_to_pax $ZOWE_ROOT_DIR/manifest.json

# Collect process information
write_to_log "Collecting current process information based on the following prefix: ${ZOWE_PREFIX}"
psgrep $ZOWE_PREFIX > $PS_OUTPUT_FILE
write_to_log "Collecting current process information based on the following prefix: ${ZOWE_PREFIX}$ZOWE_INSTANCE"
psgrep $ZOWE_PREFIX$ZOWE_INSTANCE > $PS_OUTPUT_FILE
write_to_log "Adding ${PS_OUTPUT_FILE}"
add_to_pax $PS_OUTPUT_FILE process_info
rm $PS_OUTPUT_FILE
Expand Down

0 comments on commit 23fd6f5

Please sign in to comment.