ansibleopenstackdashboardopenstack-horizonhorizon

TypeError at /project/ coercing to Unicode: need string or buffer, NoneType found


I have made a fresh install of OpenStack Ansible using this guide OSA. After running the playbooks, the installation is completed successfully without any failed plays/tasks. The server is depoloyed using Ubuntu 16.04 Server.

However, when I go to the OpenStack dashboard and log in, I get this error pastebin.

Traceback:


    Evironment:


    Request Method: GET
    Request URL: https://10.100.1.111/project/

    Django Version: 1.11.14
    Python Version: 2.7.12
    Installed Applications:
    ['openstack_dashboard.dashboards.project',
     'heat_dashboard',
     'openstack_dashboard.dashboards.admin',
     'openstack_dashboard.dashboards.identity',
     'openstack_dashboard.dashboards.settings',
     'openstack_dashboard',
     'django.contrib.contenttypes',
     'django.contrib.auth',
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'django.contrib.humanize',
     'django_pyscss',
     'openstack_dashboard.django_pyscss_fix',
     'compressor',
     'horizon',
     'openstack_auth']
    Installed Middleware:
    ('django.middleware.common.CommonMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'horizon.middleware.OperationLogMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
     'horizon.middleware.HorizonMiddleware',
     'horizon.themes.ThemeMiddleware',
     'django.middleware.locale.LocaleMiddleware',
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
     'openstack_dashboard.contrib.developer.profiler.middleware.ProfilerClientMiddleware',
     'openstack_dashboard.contrib.developer.profiler.middleware.ProfilerMiddleware')


    Template error:
    In template /openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/horizon/templates/horizon/common/_sidebar.html, error at line 4
       coercing to Unicode: need string or buffer, NoneType found   1 : {% load branding horizon i18n %}
       2 : 
       3 : 
       4 :    {% horizon_nav %} 
       5 : 
       6 : 

    Traceback:

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
      41.             response = get_response(request)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
      217.                 response = self.process_exception_by_middleware(e, request)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
      215.                 response = response.render()

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/response.py" in render
      107.             self.content = self.rendered_content

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/response.py" in rendered_content
      84.         content = template.render(context, self._request)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/backends/django.py" in render
      66.             return self.template.render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in render
      207.                     return self._render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in _render
      199.         return self.nodelist.render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in render
      990.                 bit = node.render_annotated(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in render_annotated
      957.             return self.render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/loader_tags.py" in render
      177.             return compiled_parent._render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in _render
      199.         return self.nodelist.render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in render
      990.                 bit = node.render_annotated(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in render_annotated
      957.             return self.render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/loader_tags.py" in render
      72.                 result = block.nodelist.render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in render
      990.                 bit = node.render_annotated(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in render_annotated
      957.             return self.render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/loader_tags.py" in render
      72.                 result = block.nodelist.render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in render
      990.                 bit = node.render_annotated(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in render_annotated
      957.             return self.render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/loader_tags.py" in render
      216.                 return template.render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in render
      209.                 return self._render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in _render
      199.         return self.nodelist.render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in render
      990.                 bit = node.render_annotated(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/base.py" in render_annotated
      957.             return self.render(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/django/template/library.py" in render
      225.         _dict = self.func(*resolved_args, **resolved_kwargs)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/horizon/templatetags/horizon.py" in horizon_nav
      74.                         panel.can_access(context)):

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/horizon/base.py" in can_access
      149.         return self.allowed(context)

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/horizon/base.py" in allowed
      158.         return self._can_access(context['request'])

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/horizon/base.py" in _can_access
      170.                 if policy_check(rule_param, request):

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/openstack_auth/policy.py" in check
      148.     enforcer = _get_enforcer()

    File "/openstack/venvs/horizon-19.0.0.0b1/lib/python2.7/site-packages/openstack_auth/policy.py" in _get_enforcer
      57.             if os.path.isfile(enforcer.policy_path):

    File "/usr/lib/python2.7/genericpath.py" in isfile
      37.         st = os.stat(path)

    Exception Type: TypeError at /project/
    Exception Value: coercing to Unicode: need string or buffer, NoneType found

I don't understand this error. The OpenStack API is working fine when I use the OS client. The only problem is that I can't work with OpenStack dashboard due to this problem.

Please help. Thanks in advance.


Solution

  • I came across this issue too. I hope my experience can be helpful for someone else who encounters this problem. In my case, I just removed 'orchestration' from the policy filters in dashboard settings. You can try commenting out this line in the settings file (/etc/openstack-dashboard/local_settings.py):

    'orchestration': '/usr/local/lib/python2.7/dist-packages/heat_dashboard/conf/heat_policy.json',

    For example in /etc/openstack-dashboard/local_settings.py

    from:

         POLICY_FILES = {
             'orchestration': '/usr/local/lib/python2.7/dist-packages/heat_dashboard/conf/heat_policy.json',
             'identity': 'keystone_policy.json',
             'compute': 'nova_policy.json',
             'volume': 'cinder_policy.json',
             'image': 'glance_policy.json',
             'network': 'neutron_policy.json'
    }
    

    to:

    POLICY_FILES = {
    #    'orchestration': '/usr/local/lib/python2.7/dist-packages/heat_dashboard/conf/heat_policy.json',
        'identity': 'keystone_policy.json',
        'compute': 'nova_policy.json',
        'volume': 'cinder_policy.json',
        'image': 'glance_policy.json',
        'network': 'neutron_policy.json'
    }