Drop alembic fake base-runtime code.

In favor of the fake base-runtime code in manage.py from #225.
This commit is contained in:
Ralph Bean
2016-11-28 11:45:58 -05:00
parent 27484f2c32
commit 20a235202e
2 changed files with 18 additions and 72 deletions

View File

@@ -99,6 +99,7 @@ def upgradedb():
""" Upgrades the database schema to the latest revision
"""
flask_migrate.upgrade()
_insert_fake_baseruntime()
@manager.command
@@ -160,6 +161,17 @@ def _insert_fake_baseruntime():
mmd = modulemd.ModuleMetadata()
mmd.loads(yaml)
# Check to see if this thing already exists...
query = models.ModuleBuild.query\
.filter_by(name=mmd.name)\
.filter_by(stream=mmd.stream)\
.filter_by(version=mmd.version)
if query.count():
logging.info('%r exists. Skipping creation.' % query.first())
return
# Otherwise, it does not exist. So, create it.
module = models.ModuleBuild.create(
db.session,
conf,

View File

@@ -1,4 +1,8 @@
"""Insert fake base-runtime.
"""Do nothing.
This used to be an upgrade that inserted a fake base-runtime module, but the
code was removed as a result of
https://pagure.io/fm-orchestrator/pull-request/225
Revision ID: 0ef60c3ed440
Revises: 145347916a56
@@ -11,79 +15,9 @@ Create Date: 2016-11-17 15:39:22.984051
revision = '0ef60c3ed440'
down_revision = '145347916a56'
from alembic import op
import sqlalchemy as sa
import os
import modulemd
yaml = """
document: modulemd
version: 1
data:
name: base-runtime
stream: master
version: 3
summary: A fake base-runtime module, used to bootstrap the infrastructure.
description: ...
profiles:
buildroot:
rpms:
- bash
- bzip2
- coreutils
- cpio
- diffutils
- fedora-release
- findutils
- gawk
- gcc
- gcc-c++
- grep
- gzip
- info
- make
- patch
- redhat-rpm-config
- rpm-build
- sed
- shadow-utils
- tar
- unzip
- util-linux
- which
- xz
srpm-buildroot:
rpms:
- bash
- fedora-release
- fedpkg-minimal
- gnupg2
- redhat-rpm-config
- rpm-build
- shadow-utils
"""
def upgrade():
from module_build_service import models, conf
engine = op.get_bind().engine
session = sa.orm.scoped_session(sa.orm.sessionmaker(bind=engine))
mmd = modulemd.ModuleMetadata()
mmd.loads(yaml)
module = models.ModuleBuild.create(
session,
conf,
name=mmd.name,
stream=mmd.stream,
version=mmd.version,
modulemd=yaml,
scmurl='...',
username='modularity',
)
module.state = models.BUILD_STATES['done']
module.state_reason = 'Artificially created.'
session.commit()
pass
def downgrade():
pass