fix up clair issue and typo

This commit is contained in:
wangyan 2018-06-10 23:18:30 -07:00
parent 8d4d1582a3
commit 2379123ff7

View File

@ -55,7 +55,7 @@ function up_notary {
WARNING: Notary migration will only allow anyone haven't migrated notary or WARNING: Notary migration will only allow anyone haven't migrated notary or
launched harbor yet. launched harbor yet.
If you want to migrate notary data, please delete all the notaryserver If you want to migrate notary data, please delete all the notaryserver
and notarysigner DB tables in pgsql manually fistly. and notarysigner DB tables in pgsql manually firstly.
******************************************************************************* *******************************************************************************
EOF EOF
exit 0 exit 0
@ -89,7 +89,11 @@ function up_clair {
echo "no vulnerability data needs to be updated." echo "no vulnerability data needs to be updated."
return 0 return 0
else else
pg_dump -U postgres postgres > /harbor-migration/db/schema/clair.pgsql
stop_pgsql postgres "/clair-db"
# it's harbor DB on pgsql.
launch_pgsql $1
## it's not a clean clair db, so cannot execute the import step. ## it's not a clean clair db, so cannot execute the import step.
## fail at here to call user to clean DB, then to run clair db migration. ## fail at here to call user to clean DB, then to run clair db migration.
if [[ $(psql -U $1 -d postgres -t -c "select count(*) from pg_tables where schemaname='public';") -ne 0 ]]; then if [[ $(psql -U $1 -d postgres -t -c "select count(*) from pg_tables where schemaname='public';") -ne 0 ]]; then
@ -98,18 +102,12 @@ function up_clair {
WARNING: Clair migration will only allow anyone haven't migrated clair or WARNING: Clair migration will only allow anyone haven't migrated clair or
launched harbor yet. launched harbor yet.
If you want to migrate clair data, please delete all the clair DB tables If you want to migrate clair data, please delete all the clair DB tables
in pgsql manually fistly. in pgsql manually firstly.
******************************************************************************* *******************************************************************************
EOF EOF
exit 0 exit 0
fi fi
set -e set -e
pg_dump -U postgres postgres > /harbor-migration/db/schema/clair.pgsql
stop_pgsql postgres "/clair-db"
# it's harbor DB on pgsql.
launch_pgsql $1
psql -U $1 -f /harbor-migration/db/schema/clair.pgsql psql -U $1 -f /harbor-migration/db/schema/clair.pgsql
stop_pgsql $1 stop_pgsql $1
fi fi