Skip to content

Commit

Permalink
Merge pull request #71 from bcgov/feature/process_skipped_orgs
Browse files Browse the repository at this point in the history
feat: add function to requeue previously skipped organizations
  • Loading branch information
WadeBarnes authored Aug 12, 2023
2 parents 3cd7773 + fbce0b1 commit db0d08b
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion openshift/manage
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ usage () {
requeueProcessedCreds
- Use with caution. Requeue any credentials that have already been posted.
requeueSkippedCorpTypes [ -d <dbPodName> ] <skippedCorpTypes>
- Requeue any corporation from the provided list of types that were initally skipped from processing.
Where:
- [ -d <dbPodName> ] - Optional - Specify the friendly name of the database pod containing the records.
- <skippedCorpTypes> - A space seperated list of corporation types to requeue.
Examples:
$0 -e dev requeueSkippedCorpTypes FI LIB PAR
$0 -e dev requeueSkippedCorpTypes -d my-event-db FI LIB PAR
requeueOrganization <corp_num>
- Use with caution. Requeue a specific company that may have already been processed.
Where:
Expand Down Expand Up @@ -194,7 +203,7 @@ usage () {
untagApplicationImages <tag/>
- Deletes a specific tag from all of the application images.
- Handy for cleaning up backups of images.
- Handy for cleaning up backups of images.
scaleUp
- Scale up one or more pods.
Expand Down Expand Up @@ -494,6 +503,34 @@ EOF
)
}

function requeueSkippedCorpTypes() {

local OPTIND
unset _dbPodName
while getopts d: FLAG; do
case $FLAG in
d )
_dbPodName=$OPTARG
;;
esac
done
shift $((OPTIND-1))

_podName=${_dbPodName:-event-db}
_skippedTypes=${@}
if [ -z "${_skippedTypes}" ]; then
echoError "\nrequeueSkippedCorpTypes; You MUST specify a list of skipped corp types.\n"
exit 1
fi

for type in ${_skippedTypes}; do
echo
runInContainer -v \
${_podName}${resourceSuffix} \
"psql -d "'${POSTGRESQL_DATABASE}'" -ac \"update event_by_corp_filing set process_success = null, process_date = null, process_msg = null where process_msg like '${type}: Skipped%';\""
done
}

function requeueProcessedCreds() {
_podName=${1}
if [ -z "${_podName}" ]; then
Expand Down Expand Up @@ -935,6 +972,9 @@ case "${_cmd}" in
dbPodName=${1:-event-db}
requeueProcessedCreds "${dbPodName}"
;;
requeueskippedcorptypes)
requeueSkippedCorpTypes ${@}
;;
requeueorganization)
corpNum=${1}
dbPodName=${2:-event-db}
Expand Down

0 comments on commit db0d08b

Please sign in to comment.