RDO tickets are now tracked in Jira https://issues.redhat.com/projects/RDO/issues/
Bug 1145113 - [Juno-M3] `keystone-manage db_sync keystone` fails with: DbMigrationError: version should be an integer
Summary: [Juno-M3] `keystone-manage db_sync keystone` fails with: DbMigrationError: ve...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: RDO
Classification: Community
Component: openstack-keystone
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Alan Pevec (Fedora)
QA Contact: Udi Kalifon
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-22 12:17 UTC by Kashyap Chamarthy
Modified: 2016-04-26 16:40 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-22 12:35:23 UTC
Embargoed:


Attachments (Terms of Use)

Description Kashyap Chamarthy 2014-09-22 12:17:13 UTC
Description of problem
----------------------

With Juno-Milestone3 packages, running `keystone-manage db_sync` fails
with:

    2014-09-22 07:46:35.011 8028 CRITICAL keystone [-] DbMigrationError: version should be an integer


Version
-------

    $ rpm -qa | egrep -i 'python-sqlalchemy|openstack-*'
    openstack-neutron-2014.2-0.6.b3.fc22.noarch
    openstack-utils-2014.1-3.fc21.1.noarch
    openstack-glance-2014.2-0.7.b3.fc22.noarch
    python-sqlalchemy-0.9.7-2.fc21.x86_64
    openstack-keystone-2014.2-0.4.b3.fc22.noarch


How reproducible: Consistently.


Steps to Reproduce
------------------

In an OpenStack VM:

1. Setup Keystone:

    $ openstack-db --init --service keystone

2. Setup the location of databse on config file:

    $ openstack-config --set /etc/keystone/keystone.conf \
      database connection mysql://keystone:fedora@controller/keystone

3. Create Keystone database user:

    $ mysql -u root -p
    Enter password: 
    [. . .]
    MariaDB [(none)]> CREATE DATABASE keystone;
    Query OK, 1 row affected (0.00 sec)
    
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \
        ->   IDENTIFIED BY 'fedora';
    Query OK, 0 rows affected (0.00 sec)
    
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
        ->   IDENTIFIED BY 'fedora';
    Query OK, 0 rows affected (0.00 sec)
    
    MariaDB [(none)]> exit
    Bye

4. Create the database tables for the Identity Service:

    $ keystone-manage db_sync keystone


Actual results 
--------------

    $ keystone-manage db_sync keystone
    $ echo $?
    1


From /var/log/keystone/keystone.log:

[. . .]
2014-09-22 07:46:35.011 8028 CRITICAL keystone [-] DbMigrationError: version should be an integer
2014-09-22 07:46:35.011 8028 TRACE keystone Traceback (most recent call last):
2014-09-22 07:46:35.011 8028 TRACE keystone   File "/usr/bin/keystone-manage", line 44, in <module>
2014-09-22 07:46:35.011 8028 TRACE keystone     cli.main(argv=sys.argv, config_files=config_files)
2014-09-22 07:46:35.011 8028 TRACE keystone   File "/usr/lib/python2.7/site-packages/keystone/cli.py", line 291, in main
2014-09-22 07:46:35.011 8028 TRACE keystone     CONF.command.cmd_class.main()
2014-09-22 07:46:35.011 8028 TRACE keystone   File "/usr/lib/python2.7/site-packages/keystone/cli.py", line 73, in main
2014-09-22 07:46:35.011 8028 TRACE keystone     migration_helpers.sync_database_to_version(extension, version)
2014-09-22 07:46:35.011 8028 TRACE keystone   File "/usr/lib/python2.7/site-packages/keystone/common/sql/migration_helpers.py", line 204, in sync_database_to_version
2014-09-22 07:46:35.011 8028 TRACE keystone     _sync_common_repo(version)
2014-09-22 07:46:35.011 8028 TRACE keystone   File "/usr/lib/python2.7/site-packages/keystone/common/sql/migration_helpers.py", line 160, in _sync_common_repo
2014-09-22 07:46:35.011 8028 TRACE keystone     init_version=init_version)
2014-09-22 07:46:35.011 8028 TRACE keystone   File "/usr/lib/python2.7/site-packages/oslo/db/sqlalchemy/migration.py", line 72, in db_sync
2014-09-22 07:46:35.011 8028 TRACE keystone     message=_("version should be an integer"))
2014-09-22 07:46:35.011 8028 TRACE keystone DbMigrationError: version should be an integer
2014-09-22 07:46:35.011 8028 TRACE keystone 
[. . .]

Expected results
----------------

DB sync to be successful, and all relevant tables for Keystone should be
created correctly.

Additional info
---------------

(a) MariaDB info (No tables for Keystone are created):

    $ mysql -u keystone -p'fedora'                                                                                                     
    [. . .]
    MariaDB [(none)]> use keystone; show tables;                                                                                                          
    Database changed
    Empty set (0.00 sec)


(b) SELinux:

    $ getenforce
    Permissive

    $ sestatus
    sestatus 
    SELinux status:                 enabled
    SELinuxfs mount:                /sys/fs/selinux
    SELinux root directory:         /etc/selinux
    Loaded policy name:             targeted
    Current mode:                   permissive
    Mode from config file:          permissive
    Policy MLS status:              enabled
    Policy deny_unknown status:     allowed
    Max kernel policy version:      29

Comment 1 Alan Pevec (Fedora) 2014-09-22 12:35:23 UTC
> With Juno-Milestone3 packages, running `keystone-manage db_sync` fails
> with:
> 
>     2014-09-22 07:46:35.011 8028 CRITICAL keystone [-] DbMigrationError:
> version should be an integer

> 4. Create the database tables for the Identity Service:
> 
>     $ keystone-manage db_sync keystone

usage: keystone-manage [db_sync|db_version|mapping_purge|pki_setup|ssl_setup|token_flush] db_sync
       [-h] [--extension EXTENSION] [version]

Comment 2 Alan Pevec (Fedora) 2014-09-22 12:35:59 UTC
Just use:
$ keystone-manage db_sync

Comment 3 Kashyap Chamarthy 2014-09-22 15:40:03 UTC
Urgh, sorry about this noise, bad typo :-(. Thank Alan.


Note You need to log in before you can comment on or make changes to this bug.