Guruprasad has proposed merging ~lgp171188/launchpad:qastaging-db-restore-fixes into launchpad:master.
Commit message: Add the fixes needed to get the qastaging db restore working * Use the staging database name variable instead of a hard-coded value This will allow running the restore in other environments like qastaging * Update the db config only for the keys that exist in the config file This fixes an exception in environments like the launchpad-db-update charm where the `rw_main_standby` database configuration key is set to `None` and it is not used at all. Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/472962 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:qastaging-db-restore-fixes into launchpad:master.
diff --git a/database/replication/Makefile b/database/replication/Makefile index 950c1c4..bf0d8ea 100644 --- a/database/replication/Makefile +++ b/database/replication/Makefile @@ -120,7 +120,7 @@ stagingswitch: done # Kill the existing staging database if it exists. -LPCONFIG=${STAGING_CONFIG} LP_DESTROY_REMOTE_DATABASE=yes \ - ${PGMASSACRE} lpmain_staging + ${PGMASSACRE} ${STAGING_DBNAME_MAIN} # Rename the newly-built staging databases. psql ${STAGING_DBOPTS} -d template1 -c \ "ALTER DATABASE ${STAGING_DBNAME_MAIN}_new RENAME TO ${STAGING_DBNAME_MAIN};" diff --git a/lib/lp/services/scripts/__init__.py b/lib/lp/services/scripts/__init__.py index d7edfa9..3790e22 100644 --- a/lib/lp/services/scripts/__init__.py +++ b/lib/lp/services/scripts/__init__.py @@ -170,10 +170,12 @@ def db_options(parser): ] config_data = ["[database]"] for con_str_key in connection_string_keys: - con_str = ConnectionString(getattr(config.database, con_str_key)) - for kwarg, kwval in kw.items(): - setattr(con_str, kwarg, kwval) - config_data.append("%s: %s" % (con_str_key, str(con_str))) + con_str_val = getattr(config.database, con_str_key) + if con_str_val: + con_str = ConnectionString(con_str_val) + for kwarg, kwval in kw.items(): + setattr(con_str, kwarg, kwval) + config_data.append("%s: %s" % (con_str_key, str(con_str))) config.push("update_db_config", "\n".join(config_data)) def dbname_callback(option, opt_str, value, parser):
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp