/project/ 上的 TypeError 强制转换为 Unicode:需要字符串或缓冲区,找不到 NoneType

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

我使用本指南 OSA 全新安装了 OpenStack Ansible。 运行 剧本后,安装成功完成,没有任何失败 plays/tasks。使用 Ubuntu 16.04 服务器部署服务器。

但是,当我转到 OpenStack 仪表板并登录时,我收到此错误 pastebin

回溯:


    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

我不明白这个错误。当我使用 OS 客户端时,OpenStack API 工作正常。唯一的问题是由于这个问题我无法使用 OpenStack 仪表板。

请帮忙。提前致谢。

我也遇到了这个问题。我希望我的经验对遇到此问题的其他人有所帮助。就我而言,我只是从仪表板设置的策略过滤器中删除了 'orchestration'。 您可以尝试在设置文件 (/etc/openstack-dashboard/local_settings.py):

中注释掉这一行

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

例如在/etc/openstack-dashboard/local_settings.py

来自:

     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'
}

至:

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'
}