Bug 1211465

Summary: beaker-init is not compatible with python-alembic 0.7
Product: [Retired] Beaker Reporter: matt jia <mjia>
Component: schedulerAssignee: matt jia <mjia>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: developCC: aigao, dcallagh, dowang, ebaak, tflink
Target Milestone: 21.0Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-26 06:17:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description matt jia 2015-04-14 04:31:28 UTC
Description of problem:

Running beaker-init to initialize a new database on RHEL 7 which has python-alembic 0.7 installed is failed. It is because the context._current_rev and context._update_current_rev are deprecated in python-alembic 0.7. See more details here

https://github.com/g2p/bedup/issues/75

How reproducible:

Always

Actual results:

  prop = self._property_from_column(key, prop)
Traceback (most recent call last):
  File "/bin/beaker-init", line 9, in <module>
    load_entry_point('bkr.server==19.3', 'console_scripts', 'beaker-init')()
  File "/usr/lib/python2.7/site-packages/bkr/server/tools/init.py", line 295, in main
    init_db(metadata)
  File "/usr/lib/python2.7/site-packages/bkr/server/tools/init.py", line 43, in init_db
    run_alembic_operation(metadata, stamp)
  File "/usr/lib/python2.7/site-packages/bkr/server/tools/init.py", line 255, in run_alembic_operation
    env_context.run_migrations()
  File "/usr/lib/python2.7/site-packages/alembic/environment.py", line 742, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/usr/lib/python2.7/site-packages/alembic/migration.py", line 296, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/usr/lib/python2.7/site-packages/bkr/server/tools/init.py", line 39, in stamp
    current = context._current_rev()
AttributeError: 'MigrationContext' object has no attribute '_current_rev'

Expected results:

beaker-init should be successfully run with python-alembic 0.7

Comment 1 matt jia 2015-04-14 04:36:34 UTC
(In reply to matt jia from comment #0)
> Description of problem:
> 
> Running beaker-init to initialize a new database on RHEL 7 which has
> python-alembic 0.7 installed is failed. It is because the
> context._current_rev and context._update_current_rev are deprecated in
> python-alembic 0.7. See more details here
> 
> https://github.com/g2p/bedup/issues/75

We can use context.get_current_revision() to take place of context._current_rev but I did not find a method to replace context._update_current_rev(). Probably we should wrap the alembic command module to eliminate such that pain.

Comment 2 Tim Flink 2015-05-22 02:01:33 UTC
Are there any workarounds for this issue or is the only solution to install beaker on RHEL 6 instead of RHEL 7?

Comment 3 Amit Saha 2015-05-22 02:06:07 UTC
(In reply to matt jia from comment #1)
> (In reply to matt jia from comment #0)
> > Description of problem:
> > 
> > Running beaker-init to initialize a new database on RHEL 7 which has
> > python-alembic 0.7 installed is failed. It is because the
> > context._current_rev and context._update_current_rev are deprecated in
> > python-alembic 0.7. See more details here
> > 
> > https://github.com/g2p/bedup/issues/75

This is returning a 404.

Comment 4 matt jia 2015-05-22 02:08:28 UTC
(In reply to Amit Saha from comment #3)
> (In reply to matt jia from comment #1)
> > (In reply to matt jia from comment #0)
> > > Description of problem:
> > > 
> > > Running beaker-init to initialize a new database on RHEL 7 which has
> > > python-alembic 0.7 installed is failed. It is because the
> > > context._current_rev and context._update_current_rev are deprecated in
> > > python-alembic 0.7. See more details here
> > > 
> > > https://github.com/g2p/bedup/issues/75
> 
> This is returning a 404.

Perhaps they deleted it. Here is another one 

https://github.com/g2p/bedup/issues/55

Comment 5 matt jia 2015-05-22 02:11:26 UTC
(In reply to Tim Flink from comment #2)
> Are there any workarounds for this issue or is the only solution to install
> beaker on RHEL 6 instead of RHEL 7?

We would need to write a patch to get beaker-init support both alembic versions, currently it only supports alembic version <= 0.6.

Comment 6 Tim Flink 2015-05-22 02:26:47 UTC
(In reply to matt jia from comment #5)
> (In reply to Tim Flink from comment #2)
> > Are there any workarounds for this issue or is the only solution to install
> > beaker on RHEL 6 instead of RHEL 7?
> 
> We would need to write a patch to get beaker-init support both alembic
> versions, currently it only supports alembic version <= 0.6.

OK, I'll see if I can get an older alembic to build on el7 (first epel7 build seems to be 0.7.x) and hack that in for the time being. Otherwise, I'll just redeploy our new instance as el6 and upgrade sometime in the future.

Comment 7 matt jia 2015-06-03 03:41:55 UTC
On Gerrit:

 http://gerrit.beaker-project.org/#/c/4232/

Comment 8 matt jia 2015-06-16 00:12:08 UTC
Verified Steps:

1. create an empty beaker database on the server that has python-alembic 0.7 installed

2. run beaker-init to initialize this database

3. also need to check beaker-init on the server that has python-alembic 0.6

Comment 11 Dan Callaghan 2015-08-26 06:17:23 UTC
Beaker 21.0 has been released.