HCL-TECH-SOFTWARE / connections-automation

Deployment and upgrade automation scripts for HCL Connections 7.0 based on Ansible

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing package dos2unix for db2 server

marde16 opened this issue · comments

When an admin prepare a new environment for a side-by-side migration and must migrate Docs 2.0.1 to Docs 2.0.2 (under CentOS 7 (minimal installation)) the following script updateDBSchema.sh can't update the schema because of the missing package dos2unix to run this command dos2unix -n fixup$VERSION.sql fixup_tmp.sql

# Get schema from DB
db2 connect to CONCORD 
#db2 connect to CONCORD >/dev/null 2>&1
output=`db2 -x "select \"SCHEMA_VERSION\" from \"CONCORDDB\".\"PRODUCT\" where \"ID\"='lotuslive.symphony'"` 
db2 connect reset

# Parse schema number, or set to 0 if not found
trim() { echo $1; }
VERSION="$(trim $output )"
echo "Schema version number is $VERSION"
if ! [[ "$VERSION" =~ ^[0-9]+$ ]]
then
	echo "Get NON-NUMBER FOR SCHEMEMA version, SET IT TO ZERO "
	VERSION=0
fi
echo "update sql with version $VERSION"

DIRTY=0

while [ "" = "" ]
do
    ((VERSION++))
    if [ -f "fixup$VERSION.sql" ]
    then
        echo "applying fixup$VERSION.sql"
        dos2unix -n fixup$VERSION.sql fixup_tmp.sql
        mv -f fixup_tmp.sql fixup$VERSION.sql
        db2 -td@ -f fixup$VERSION.sql
        DIRTY=1
    else
        break
    fi
done

:
:

Please update the setup_os.yml playbook.

Hi Martin, thank you for the feedback. Please submit a PR for this change and it will be merged into the Connections-Automation repository. Thanks again.