diff --git a/Templates/Common-Backend-Scripts/generateCleanupCommands.sh b/Templates/Common-Backend-Scripts/generateCleanupCommands.sh index 0daedaa6..764c8f05 100755 --- a/Templates/Common-Backend-Scripts/generateCleanupCommands.sh +++ b/Templates/Common-Backend-Scripts/generateCleanupCommands.sh @@ -72,13 +72,12 @@ Help() { } # -# Customization # Configuration file leveraged by the backend scripts # Either an absolute path or a relative path to the current working directory SCRIPT_HOME="$(dirname "$0")" pipelineConfiguration="${SCRIPT_HOME}/pipelineBackend.config" buildUtilities="${SCRIPT_HOME}/utilities/dbbBuildUtils.sh" -# Customization - End +deleteScript="${SCRIPT_HOME}/../../Utilities/DeletePDS/DeletePDS.groovy" # # Internal Variables @@ -241,6 +240,27 @@ validateOptions() { echo $ERRMSG fi + if [ -z "${dbbMetadataStoreType}" ]; then + rc=8 + ERRMSG=$PGM": [ERROR] DBB MetadataStore Type is a required configuration in pipelineBackend.config . rc="$rc + echo $ERRMSG + else + + case ${dbbMetadataStoreType} in + file) + cleanupDbbMetadataStoreOptions="--type file --location ${dbbFileMetadataStoreLocation}" + ;; + db2) + cleanupDbbMetadataStoreOptions="--type db2 --user ${dbbMetadataStoreJdbcId} --password-file ${dbbMetadataStoreJdbcPwdFile} --db2-config ${dbbMetadataStoreJdbcConfigFile} --url ${dbbMetadataStoreJdbcUrl}" + ;; + *) + rc=8 + ERRMSG=$PGM": [INFO] Invalid DBB MetadataStore Type: ${dbbMetadataStoreType}. Check required configuration in pipelineBackend.config. rc="$rc + echo $ERRMSG + ;; + esac + + fi } # Prepare output files @@ -319,7 +339,7 @@ genDeleteStatementsCollections() { for applicationCollection in ${collectionsToBeDeleted[@]}; do - echo "dbb collection delete $applicationCollection ${dbbMetadataStoreOptions}" >>${cmdFileDeleteCollections} + echo "dbb collection delete $applicationCollection ${cleanupDbbMetadataStoreOptions}" >>${cmdFileDeleteCollections} done @@ -341,7 +361,7 @@ genDeleteStatementsBuildGroups() { for buildGroup in ${buildgroupsToBeDeleted[@]}; do - echo "dbb build-group delete $buildGroup ${dbbMetadataStoreOptions}" >>${cmdFileDeleteBuildGroups} + echo "dbb build-group delete $buildGroup ${cleanupDbbMetadataStoreOptions}" >>${cmdFileDeleteBuildGroups} done @@ -381,7 +401,7 @@ if [ $rc -eq 0 ]; then echo $PGM": [INFO] ** Cmd obsolete collections:" ${cmdFileDeleteCollections} echo $PGM": [INFO] ** Cmd obsolete build groups:" ${cmdFileDeleteBuildGroups} echo $PGM": [INFO] ** Cmd obsolete build datasets:" ${cmdFileDeleteBuildDatasets} - echo $PGM": [INFO] ** DBB Metadastore Config:" ${dbbMetadataStoreOptions} + echo $PGM": [INFO] ** DBB Metadastore Config:" ${cleanupDbbMetadataStoreOptions} echo $PGM": [INFO] ** Process Cleanup Scripts:" ${executeCleanupCommandScripts} echo $PGM": [INFO] **************************************************************" echo "" @@ -390,7 +410,7 @@ fi if [ $rc -eq 0 ]; then # Retrieve existing DBB Collections echo $PGM": [STAGE] Retrieve all collections with application qualifier $App" - applicationCollections=$(dbb collection list $dbbMetadataStoreOptions | grep $App) + applicationCollections=$(dbb collection list $cleanupDbbMetadataStoreOptions | grep $App) rc=$? if [ ! $rc -eq 0 ]; then ERRMSG=$PGM": [ERROR] Retrieving Collections failed. Check Log. rc="$rc diff --git a/Templates/Common-Backend-Scripts/pipelineBackend.config b/Templates/Common-Backend-Scripts/pipelineBackend.config index e9778a48..5a9c721b 100644 --- a/Templates/Common-Backend-Scripts/pipelineBackend.config +++ b/Templates/Common-Backend-Scripts/pipelineBackend.config @@ -82,6 +82,19 @@ dbbMetadataStoreJdbcId="" # Default = None, Required. dbbMetadataStoreJdbcPwdFile="" +# Absolute path to Db2 conf file containing db2 schema etc +# Default = None, currently only referenced in generateCleanupCommands.sh +dbbMetadataStoreJdbcConfigFile="" + +# DBB Metadatastore implementation. 'db2' or 'file' +# Used to create the housekeeping instructions in generateCleanupCommands.sh +# Default: dbbMetadataStoreType=db2 +dbbMetadataStoreType="db2" + +# DBB File Metadatastore location. Only relevant when using dbbMetadataStoreType="file" +# Default dbbFileMetadataStoreLocation="${HOME}" +dbbFileMetadataStoreLocation="${HOME}" + # JDBC connection server url # sample jdbc:db2://10.3.20.201:4740/MOPDBC0 # Optional if zAppBuild is configured to use the