uselagoon / lagoon-sync

Apache License 2.0
7 stars 5 forks source link

Sync error doesn't output useful information #103

Closed rocketeerbkw closed 1 year ago

rocketeerbkw commented 1 year ago

I had problems syncing postgres when the target environment was hosted and the only error I got was not useful [FATAL] 2023/09/27 16:20:38 github.com/uselagoon/lagoon-sync/utils.LogFatalError:logs.go:76 Warning: Permanently added '[ssh.lagoon.amazeeio.cloud]:32222' (ED25519) to the list of known hosts..

In the case of postgres there were errors wtih config and restore options, I don't know if other syncers like mariadb also fail without useful information or if it's just postgres. Here's a full example:

cli-drupal:/app$ lagoon-sync sync postgres -e local -t pr-3
Project: amazeeio-example - you are about to sync postgres from local to pr-3, is this correct: y
[INFO]  2023/09/27 16:20:12 Running prerequisite checks on local
[INFO]  2023/09/27 16:20:12 Running the following prerequisite command /usr/local/bin/lagoon-sync config
[INFO]  2023/09/27 16:20:12 Beginning export on source environment local
[INFO]  2023/09/27 16:20:12 Running the following for source PGPASSWORD="${POSTGRES_PASSWORD:-drupal}" pg_dump -h${POSTGRES_HOST:-postgres} -U${POSTGRES_USERNAME:-drupal} -p${POSTGRES_PORT:-5432} -d${POSTGRES_DATABASE:-drupal}   -Fc -w -f/tmp/lagoon_sync_postgres_1695831609776875565.sql
[INFO]  2023/09/27 16:20:12 Running prerequisite checks on pr-3
[INFO]  2023/09/27 16:20:12 Running the following prerequisite command ssh -tt -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p 32222 amazeeio-example-pr-3@ssh.lagoon.amazeeio.cloud service=cli '/usr/local/bin/lagoon-sync config'
[INFO]  2023/09/27 16:20:21 Beginning file transfer logic
[INFO]  2023/09/27 16:20:21 Running the following for target (pr-3) /usr/bin/rsync --omit-dir-times --no-perms --no-group --no-owner --chmod=ugo=rwX --recursive --compress --rsync-path=/usr/bin/rsync  -e "ssh -o LogLevel=FATAL -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 32222 -l amazeeio-example-pr-3 ssh.lagoon.amazeeio.cloud service=cli"   /tmp/lagoon_sync_postgres_1695831609776875565.sql :/tmp/lagoon_sync_postgres_1695831609776875565.sql
[INFO]  2023/09/27 16:20:30 Beginning import on target environment pr-3
[INFO]  2023/09/27 16:20:30 Running the following for target (pr-3) ssh -tt -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p 32222 amazeeio-example-pr-3@ssh.lagoon.amazeeio.cloud service=cli 'PGPASSWORD="$AMAZEEIO_DB_PASSWORD" pg_restore -c -x -w -h$AMAZEEIO_DB_HOST -d$POSTGRES_DATABASE -p$AMAZEEIO_DB_PORT -U$AMAZEEIO_DB_USERNAME /tmp/lagoon_sync_postgres_1695831609776875565.sql'
[FATAL] 2023/09/27 16:20:38 github.com/uselagoon/lagoon-sync/utils.LogFatalError:logs.go:76 Warning: Permanently added '[ssh.lagoon.amazeeio.cloud]:32222' (ED25519) to the list of known hosts.
Connection to ssh.lagoon.amazeeio.cloud closed.
rocketeerbkw commented 1 year ago

Checked with mariadb by configuring an intentionally incorrect password and it also has the same issue, the command fails but there is no useful error message.