def test_db_migration_bionic_and_beyond_rocky(self, mock_subprocess): self.cmp_pkgrevno.return_value = 0 horizon_utils.os_release.return_value = 'rocky' horizon_utils.db_migration() mock_subprocess.assert_called_with([ 'python3', '/usr/share/openstack-dashboard/manage.py', 'migrate', '--noinput' ])
def test_db_migration(self, mock_subprocess): self.cmp_pkgrevno.return_value = -1 horizon_utils.os_release.return_value = 'mitaka' horizon_utils.db_migration() mock_subprocess.assert_called_with([ 'python2', '/usr/share/openstack-dashboard/manage.py', 'syncdb', '--noinput' ])
def db_changed(): if 'shared-db' not in CONFIGS.complete_contexts(): log('shared-db relation incomplete. Peer not ready?') return CONFIGS.write_all() if is_leader(): allowed_units = relation_get('allowed_units') if allowed_units and local_unit() in allowed_units.split(): db_migration() else: log('Not running neutron database migration, either no' ' allowed_units or this unit is not present') return else: log('Not running neutron database migration, not leader')