ging / fiware-idm-deprecated

DEPRECATED - Identity Manager - Keyrock
Apache License 2.0
18 stars 25 forks source link

ParseError: no element found: line 1, column 0 #69

Closed AnotherCodeArtist closed 8 years ago

AnotherCodeArtist commented 8 years ago

Hi!

Just allow me one question upfront: Do you really believe that anyone can manage to setup the interaction between IdM and AZF based on this documentation?

Anyway, I'm struggling with the configuration for some time now, and after reading some of your issue threads (e.g.: https://github.com/ging/fiware-idm/issues/49) I did the following:

# ACCESS CONTROL GE

ACCESS_CONTROL_URL = 'http://10.12.200.247:8282/authzforce-ce/domains/qgCiblr-EeanbAJCrBEABg/pap/policies'
ACCESS_CONTROL_MAGIC_KEY = 'undefined'

When checking this URL I get the following response:

<ns3:resources>
<ns4:link rel="item" href="root" />
</ns3:resources>

So whenever I save the application, I get the following error (container log):

2016-08-08 08:06:55.440 37 INFO eventlet.wsgi.server [-] 127.0.0.1 - - [08/Aug/2016 08:06:55] "GET /v3/OS-ROLES/roles/5dabbc14cf974693b9a3aadcb96fa312/permissions HTTP/1.1" 200 563 0.022872
DEBUG:idm_logger:Access Control Domain not created, creating it...
Internal Server Error: /idm/myApplications/3006d8efaa0049c48299656e604190c9/step/roles/
Traceback (most recent call last):
  File "/horizon/.venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/horizon/horizon/decorators.py", line 36, in dec
    return view_func(request, *args, **kwargs)
  File "/horizon/horizon/decorators.py", line 52, in dec
    return view_func(request, *args, **kwargs)
  File "/horizon/horizon/decorators.py", line 36, in dec
    return view_func(request, *args, **kwargs)
  File "/horizon/.venv/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/horizon/openstack_dashboard/dashboards/idm/myApplications/views.py", line 116, in dispatch
    return super(RolesView, self).dispatch(request, *args, **kwargs)
  File "/horizon/.venv/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/horizon/horizon/workflows/views.py", line 195, in post
    exceptions.handle(request)
  File "/horizon/horizon/exceptions.py", line 334, in handle
    six.reraise(exc_type, exc_value, exc_traceback)
  File "/horizon/horizon/workflows/views.py", line 190, in post
    success = workflow.finalize()
  File "/horizon/horizon/workflows/base.py", line 802, in finalize
    if not self.handle(self.request, self.context):
  File "/horizon/openstack_dashboard/dashboards/idm/myApplications/workflows.py", line 165, in handle
    'Failed to update policies in Access Control GE')
  File "/horizon/horizon/exceptions.py", line 334, in handle
    six.reraise(exc_type, exc_value, exc_traceback)
  File "/horizon/openstack_dashboard/dashboards/idm/myApplications/workflows.py", line 160, in handle
    role_permissions=role_permissions)
  File "/horizon/openstack_dashboard/fiware_api/access_control_ge.py", line 105, in policyset_update
    domain = get_application_domain(request, application)
  File "/horizon/openstack_dashboard/fiware_api/access_control_ge.py", line 61, in get_application_domain
    tree = ElementTree.fromstring(response.content)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1301, in XML
    return parser.close()
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1654, in close
    self._raiseerror(v)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1506, in _raiseerror
    raise err
ParseError: no element found: line 1, column 0
[08/Aug/2016 08:06:55] "POST /idm/myApplications/3006d8efaa0049c48299656e604190c9/step/roles/ HTTP/1.1" 500 277290

The django web app also comes up with an impressive error dump:

Environment:

Request Method: POST
Request URL: http://localhost:8000/idm/myApplications/3006d8efaa0049c48299656e604190c9/step/roles/

Django Version: 1.6.11
Python Version: 2.7.6
Installed Applications:
['openstack_dashboard.dashboards.settings',
 'openstack_dashboard.dashboards.idm',
 'openstack_dashboard.dashboards.idm_admin',
 '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',
 'nocaptcha_recaptcha',
 'django_summernote',
 'corsheaders',
 'django_gravatar']
Installed Middleware:
('corsheaders.middleware.CorsMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'openstack_dashboard.fiware_middleware.middleware.UserInfoMiddleware',
 'openstack_dashboard.fiware_middleware.middleware.OrganizationInfoMiddleware',
 'openstack_dashboard.fiware_middleware.middleware.SwitchMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'openstack_dashboard.fiware_middleware.middleware.CustomHorizonMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')

Traceback:
File "/horizon/.venv/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  112.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/horizon/horizon/decorators.py" in dec
  36.         return view_func(request, *args, **kwargs)
File "/horizon/horizon/decorators.py" in dec
  52.             return view_func(request, *args, **kwargs)
File "/horizon/horizon/decorators.py" in dec
  36.         return view_func(request, *args, **kwargs)
File "/horizon/.venv/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  69.             return self.dispatch(request, *args, **kwargs)
File "/horizon/openstack_dashboard/dashboards/idm/myApplications/views.py" in dispatch
  116.             return super(RolesView, self).dispatch(request, *args, **kwargs)
File "/horizon/.venv/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  87.         return handler(request, *args, **kwargs)
File "/horizon/horizon/workflows/views.py" in post
  195.             exceptions.handle(request)
File "/horizon/horizon/exceptions.py" in handle
  334.     six.reraise(exc_type, exc_value, exc_traceback)
File "/horizon/horizon/workflows/views.py" in post
  190.             success = workflow.finalize()
File "/horizon/horizon/workflows/base.py" in finalize
  802.         if not self.handle(self.request, self.context):
File "/horizon/openstack_dashboard/dashboards/idm/myApplications/workflows.py" in handle
  165.                 'Failed to update policies in Access Control GE')
File "/horizon/horizon/exceptions.py" in handle
  334.     six.reraise(exc_type, exc_value, exc_traceback)
File "/horizon/openstack_dashboard/dashboards/idm/myApplications/workflows.py" in handle
  160.                 role_permissions=role_permissions)
File "/horizon/openstack_dashboard/fiware_api/access_control_ge.py" in policyset_update
  105.     domain = get_application_domain(request, application)
File "/horizon/openstack_dashboard/fiware_api/access_control_ge.py" in get_application_domain
  61.         tree = ElementTree.fromstring(response.content)
File "/usr/lib/python2.7/xml/etree/ElementTree.py" in XML
  1301.     return parser.close()
File "/usr/lib/python2.7/xml/etree/ElementTree.py" in close
  1654.             self._raiseerror(v)
File "/usr/lib/python2.7/xml/etree/ElementTree.py" in _raiseerror
  1506.         raise err

Exception Type: ParseError at /idm/myApplications/3006d8efaa0049c48299656e604190c9/step/roles/
Exception Value: no element found: line 1, column 0

So what's wrong here? At least I would not expect the web-app to completely crash if there's something wrong with the configuration. An if there is something wrong with the configuration, a more verbose documentation might help?

So any help is highly appreciated, since I'm evaluating the FIWARE stack for a customer.

AnotherCodeArtist commented 8 years ago

After checking your source code I figured out how the request URL is constructed and I ended up with the following configuration:

# ACCESS CONTROL GE
ACCESS_CONTROL_URL = 'http://10.12.200.247:8282'
ACCESS_CONTROL_MAGIC_KEY = 'undefined'

Nevertheless an erroneous URL should not cause the application to fail and I'm now facing a different problem leading to new issue

aalonsog commented 8 years ago

Hi, thanks for the update. Could we close the issue?

AnotherCodeArtist commented 8 years ago

Well, if it's ok for you that the application crashes rather than providing a decent error handling, than you can close this one and probably focus on that one ;-)?

federicofdez commented 8 years ago

Hello @AnotherCodeArtist

We'll do our best to include a better error handling in case of a configuration issue with AZF in a future release of KeyRock, so that this issue is not repetead again.

I'll close the issue now if it's ok with you, but will let you know when this enhancement is included. Hope you're still interested by then :smile:

Thanks again for your contribution.