PROJQUAY-19 - correct migration logic
This commit is contained in:
parent
73bab07baf
commit
148527664d
3 changed files with 4 additions and 4 deletions
|
@ -81,7 +81,7 @@ def upgrade(tables, tester, progress_reporter):
|
||||||
op.add_column('repomirrorconfig', sa.Column('external_reference', sa.Text(), nullable=True))
|
op.add_column('repomirrorconfig', sa.Column('external_reference', sa.Text(), nullable=True))
|
||||||
|
|
||||||
from app import app
|
from app import app
|
||||||
if app.config.get('SETUP_COMPLETE', False) or tester.is_testing:
|
if not app.config.get('SETUP_COMPLETE', False) or tester.is_testing:
|
||||||
for repo_mirror in _iterate(RepoMirrorConfig, (RepoMirrorConfig.external_reference >> None)):
|
for repo_mirror in _iterate(RepoMirrorConfig, (RepoMirrorConfig.external_reference >> None)):
|
||||||
repo = '%s/%s/%s' % (repo_mirror.external_registry, repo_mirror.external_namespace, repo_mirror.external_repository)
|
repo = '%s/%s/%s' % (repo_mirror.external_registry, repo_mirror.external_namespace, repo_mirror.external_repository)
|
||||||
logger.info('migrating %s' % repo)
|
logger.info('migrating %s' % repo)
|
||||||
|
@ -112,7 +112,7 @@ def downgrade(tables, tester, progress_reporter):
|
||||||
op.add_column('repomirrorconfig', sa.Column('external_repository', sa.String(length=255), nullable=True))
|
op.add_column('repomirrorconfig', sa.Column('external_repository', sa.String(length=255), nullable=True))
|
||||||
|
|
||||||
from app import app
|
from app import app
|
||||||
if app.config.get('SETUP_COMPLETE', False):
|
if not app.config.get('SETUP_COMPLETE', False):
|
||||||
logger.info('Restoring columns from external_reference')
|
logger.info('Restoring columns from external_reference')
|
||||||
for repo_mirror in _iterate(RepoMirrorConfig, (RepoMirrorConfig.external_registry >> None)):
|
for repo_mirror in _iterate(RepoMirrorConfig, (RepoMirrorConfig.external_registry >> None)):
|
||||||
logger.info('Restoring %s' % repo_mirror.external_reference)
|
logger.info('Restoring %s' % repo_mirror.external_reference)
|
||||||
|
|
|
@ -99,7 +99,7 @@ def upgrade(tables, tester, progress_reporter):
|
||||||
op = ProgressWrapper(original_op, progress_reporter)
|
op = ProgressWrapper(original_op, progress_reporter)
|
||||||
|
|
||||||
from app import app
|
from app import app
|
||||||
if app.config.get('SETUP_COMPLETE', False) or tester.is_testing:
|
if not app.config.get('SETUP_COMPLETE', False) or tester.is_testing:
|
||||||
# Empty all access token names to fix the bug where we put the wrong name and code
|
# Empty all access token names to fix the bug where we put the wrong name and code
|
||||||
# in for some tokens.
|
# in for some tokens.
|
||||||
AccessToken.update(token_name=None).where(AccessToken.token_name >> None).execute()
|
AccessToken.update(token_name=None).where(AccessToken.token_name >> None).execute()
|
||||||
|
|
|
@ -40,7 +40,7 @@ def upgrade(tables, tester, progress_reporter):
|
||||||
|
|
||||||
# Overwrite all plaintext robot credentials.
|
# Overwrite all plaintext robot credentials.
|
||||||
from app import app
|
from app import app
|
||||||
if app.config.get('SETUP_COMPLETE', False) or tester.is_testing:
|
if not app.config.get('SETUP_COMPLETE', False) or tester.is_testing:
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
robot_account_token = RobotAccountToken.get(fully_migrated=False)
|
robot_account_token = RobotAccountToken.get(fully_migrated=False)
|
||||||
|
|
Reference in a new issue