Bug 1234250 - horizon manage.py syncdb errors on "App 'openstack_auth' doesn't have a 'user' model."
Summary: horizon manage.py syncdb errors on "App 'openstack_auth' doesn't have a 'user...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-django-openstack-auth
Version: 7.0 (Kilo)
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ga
: 7.0 (Kilo)
Assignee: Matthias Runge
QA Contact: Ido Ovadia
URL:
Whiteboard:
Depends On: 1232683
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-22 07:51 UTC by Matthias Runge
Modified: 2023-02-22 23:02 UTC (History)
3 users (show)

Fixed In Version: python-django-openstack-auth-1.2.0-3.el7ost
Doc Type: Bug Fix
Doc Text:
Clone Of: 1232683
Environment:
Last Closed: 2015-08-05 13:28:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2015:1548 0 normal SHIPPED_LIVE Red Hat Enterprise Linux OpenStack Platform Enhancement Advisory 2015-08-05 17:07:06 UTC

Description Matthias Runge 2015-06-22 07:51:45 UTC
+++ This bug was initially created as a clone of Bug #1232683 +++

Description of problem:

When running /usr/share/openstack-dashboard/manage.py syncdb --noinput after creating the database it errors with this message:

                                Traceback (most recent call last):
                                  File "/usr/share/openstack-dashboard/manage.py", line 23, in <module>
                                    execute_from_command_line(sys.argv)
                                  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
                                    utility.execute()
                                  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
                                    self.fetch_command(subcommand).run_from_argv(self.argv)
                                  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
                                    self.execute(*args, **cmd_options)
                                  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 440, in execute
                                    self.check()
                                  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 478, in check
                                    include_deployment_checks=include_deployment_checks,
                                  File "/usr/lib/python2.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
                                    new_errors = check(app_configs=app_configs)
                                  File "/usr/lib/python2.7/site-packages/django/contrib/auth/checks.py", line 12, in check_user_model
                                    cls = apps.get_model(settings.AUTH_USER_MODEL)
                                  File "/usr/lib/python2.7/site-packages/django/apps/registry.py", line 202, in get_model
                                    return self.get_app_config(app_label).get_model(model_name.lower())
                                  File "/usr/lib/python2.7/site-packages/django/apps/config.py", line 162, in get_model
                                    "App '%s' doesn't have a '%s' model." % (self.label, model_name))
                                LookupError: App 'openstack_auth' doesn't have a 'user' model.

Version-Release number of selected component (if applicable):

openstack-dashboard-2015.1.0-7.el7.noarch.rpm

How reproducible:


Steps to Reproduce:
1. Install openstack-dashboard-2015.1.0-7.el7.noarch.rpm
2. Create MySQL database & configure it in local_settings
3. Run /usr/share/openstack-dashboard/manage.py syncdb

Actual results:

Error above

Expected results:

No error and a populated horizon database.

Additional info:

--- Additional comment from Matthias Runge on 2015-06-19 15:06:53 EDT ---

I was able to fix this issue by adding

from user import User

to
openstack_auth/__init__.py:


git diff
diff --git a/openstack_auth/__init__.py b/openstack_auth/__init__.py
index 67e4860..cf681c2 100644
--- a/openstack_auth/__init__.py
+++ b/openstack_auth/__init__.py
@@ -13,5 +13,6 @@
 
 import pbr.version
 
+from user import User
 
 __version__ = pbr.version.VersionInfo('django_openstack_auth').version_string()


A package update will follow shortly.

Comment 6 Matthias Runge 2015-06-29 08:28:06 UTC
how to test:

https://bugzilla.redhat.com/show_bug.cgi?id=1120305#c37

Comment 7 Ido Ovadia 2015-07-02 09:36:45 UTC
Failed: python-django-openstack-auth-1.2.0-3.el7ost.noarch
===========================================================

Traceback (most recent call last):
  File "manage.py", line 23, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 34, in handle
    if not UserModel._default_manager.exists() and options.get('interactive'):
  File "/usr/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 586, in exists
    return self.query.has_results(using=self.db)
  File "/usr/lib/python2.7/site-packages/django/db/models/sql/query.py", line 479, in has_results
    return compiler.has_results()
  File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 808, in has_results
    return bool(self.execute_sql(SINGLE))
  File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 837, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/utils.py", line 97, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 124, in execute
    return self.cursor.execute(query, args)
  File "/usr/lib64/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
django.db.utils.ProgrammingError: (1146, "Table 'horizon.openstack_auth_user' doesn't exist")

Comment 8 Matthias Runge 2015-07-02 12:52:33 UTC
Hmm,

actually, the command ./manage.py syncdb is not correct, one should rather use
./manage.py migrate


# mysql
create database horizon;
create user horizon identified by 'horizon';
grant all on horizon.* to 'horizon'@'localhost' identified by 'horizon';


add to local_settings:
DATABASES = {
    'default': {
        'ENGINE':'django.db.backends.mysql',
        'NAME': 'horizon',
        'USER': 'horizon',
        'PASSWORD': 'horizon',
        'HOST': 'localhost',
    }
}
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'


Test it:

MariaDB [(none)]> drop database horizon;
Query OK, 6 rows affected (0.26 sec)

MariaDB [(none)]> create database horizon;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> Bye

[root@rhos-7-access-plugin openstack-dashboard]# ./manage.py migrate
WARNING:root:"dashboards" and "default_dashboard" in (local_)settings is DEPRECATED now and may be unsupported in some future release. The preferred way to specify the order of dashboards and the default dashboard is the pluggable dashboard mechanism (in /usr/share/openstack-dashboard/openstack_dashboard/enabled, /usr/share/openstack-dashboard/openstack_dashboard/local/enabled).
Operations to perform:
  Synchronize unmigrated apps: openstack_auth, settings, admin, messages, openstack_dashboard, compressor, project, staticfiles, theme, humanize, django_pyscss, horizon, django_pyscss_fix, identity
  Apply all migrations: contenttypes, auth, sessions
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0001_initial... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying sessions.0001_initial... OK

And finally: restart httpd and try it out.

Comment 11 errata-xmlrpc 2015-08-05 13:28:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2015:1548


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