Skip to content

Commit bf52ca3

Browse files
authored
clone_wp_site.py: Update database config properly, fix #8
This updates the dst wp-config to use the dst database, as intended. It does this immediately after copying the files so that if any later steps of the script fail, we don't wind up with an app that appears to work because it's pointing to the src database.
1 parent 13642f1 commit bf52ca3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

examples/clone_wp_site.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ def main(args):
148148
log.info(f'Copying files')
149149
sshrunner.run_passbased_rsync(f'{src_app_path}/', f'{userhost}:{dst_app_path}/')
150150

151+
log.info(f'Updating database configuration')
152+
sshrunner.run_passbased_ssh(f'/home/{DST_OSUSER_NAME}/bin/wp --path={dst_app_path} config set DB_HOST {dst_db_host}')
153+
sshrunner.run_passbased_ssh(f'/home/{DST_OSUSER_NAME}/bin/wp --path={dst_app_path} config set DB_USER {dst_db_user}')
154+
sshrunner.run_passbased_ssh(f'/home/{DST_OSUSER_NAME}/bin/wp --path={dst_app_path} config set DB_PASSWORD {dst_db_pass}')
155+
sshrunner.run_passbased_ssh(f'/home/{DST_OSUSER_NAME}/bin/wp --path={dst_app_path} config set DB_NAME {dst_db_name}')
156+
151157
log.info(f'Copying database content')
152158
sshrunner.run_passbased_scp(sql_filepath_local, f'{userhost}:')
153159
os.remove(sql_filepath_local)

0 commit comments

Comments
 (0)