Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
Merge branch 'upstream-db-migrate'
Browse files Browse the repository at this point in the history
  • Loading branch information
seandst committed Jan 6, 2015
2 parents 86ee397 + d9b58d9 commit 00c7cf9
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions utils/appliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def _configure_5_3(self, log_callback=None):

def _configure_upstream(self, log_callback=None):
self.ipapp.fix_ntp_clock(log_callback=log_callback)
self.ipapp.migrate_db(log_callback=log_callback)
self.ipapp.wait_for_web_ui(log_callback=log_callback)
self.ipapp.loosen_pgssl(log_callback=log_callback)
self.ipapp.clone_domain(log_callback=log_callback)
Expand Down Expand Up @@ -447,6 +448,40 @@ def precompile_assets(self, log_callback=None):

return status

def migrate_db(self, log_callback=None):
"""Run database migrations
Note:
This is a workaround put in place to get upstream appliance provisioning working again
"""
if self.version != LATEST:
return

if log_callback is None:
log_callback = lambda msg: self.log.info("DB migration: {}".format(msg))
else:
cb = log_callback
log_callback = lambda msg: cb("DB migration: {}".format(msg))

client = self.ssh_client()

# Make sure the database is ready
log_callback('Starting migrations')
self.wait_for_db()

# Make sure the working dir exists
result = client.run_rake_command('db:migrate')

if result.rc != 0:
msg = 'DB Migration failed'
log_callback(msg)
raise ApplianceException(msg)

self.restart_evm_service(log_callback=log_callback)

return result

def clone_domain(self, source="ManageIQ", dest="Default", log_callback=None):
"""Clones Automate domain
Expand Down

0 comments on commit 00c7cf9

Please sign in to comment.