Hi, all

I'm not sure if vitrage follows the RESTful API.

In RESTful API, it is reasonable to return 404 error when the requested
resource does not exist. If we want to display a friendly message, it could
be implemented in front end.

The backend API should remain simple and consistent since we may have
different consumers, e.g. a CLI who does not understand error message at
all.

--
Yujun ZHANG

On Wed, May 25, 2016 at 2:57 PM Afek, Ifat (Nokia - IL) <[email protected]>
wrote:

> Hi dwj,
>
>
>
> I’m passing the question (and answer) to openstack mailing list.
>
>
>
> You are right. In case of an invalid vitrage id, we should not return HTTP
> 404 error. I think the correct behavior would be to return a nice error
> message like “Alarm XYZ does not exist”.
>
> You can open a bug about it.
>
>
>
> Thanks,
>
> Ifat.
>
>
>
> *From:* [email protected] [mailto:[email protected]]
> *Sent:* Wednesday, May 25, 2016 9:24 AM
> *To:* Weyl, Alexey (Nokia - IL); Afek, Ifat (Nokia - IL); Rosensweig,
> Elisha (Nokia - IL); Shamir, Ohad (Nokia - IL)
> *Subject:* input erroneous `vitrage_id` in `vitrage rca show`API or
> `vitrage topology show` API
>
>
>
>
> Hi folks,
>
> `vitrage rca show` has the positional arguments: alarm_id
>
> `vitrage topology show` API has the optional arguments: --root
>
> They all means the `vitrage_id` in vertex, and those APIs also call the
> function of `*graph_query_vertices*(*self*, query_dict=None, root_id=None,
> depth=None,
>                              direction=Direction.BOTH)`
>
> But if the user input the erroneous `vitrage_id` which was not exist in
> the nodes,
> Do the APIs all need to return the HTTP 404 error?
>
> See the code:
>
> https://github.com/openstack/vitrage/blob/master/vitrage/graph/algo_driver/networkx_algorithm.py#L43
>
> Do we need to unify the return value as a empty graph in function `
> *graph_query_vertices*`
> if the root is not be found or the root_data don't match the query?
> Or leave it, don't modify, return the HTTP 404?
>
> Thanks.
>
> The error log:
> stack@cloud:~$ vitrage rca show 'ALARM:nagios:cloud:test'
> Unknown Error (HTTP 404)
>
> 2016-05-25 12:26:08.734 10742 DEBUG
> vitrage.entity_graph.api_handler.entity_graph_api [-] EntityGraphApis
> get_rca root:ALARM:nagios:cloud:test get_rca
> /opt/stack/vitrage/vitrage/entity_graph/api_handler/entity_graph_api.py:114
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher [-]
> Exception during message handling: u'ALARM:nagios:cloud:test'
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher
> Traceback (most recent call last):
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher   File
> "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py",
> line 138, in _dispatch_and_reply
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher
> incoming.message))
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher   File
> "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py",
> line 185, in _dispatch
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher
> return self._do_dispatch(endpoint, method, ctxt, args)
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher   File
> "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py",
> line 127, in _do_dispatch
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher
> result = func(ctxt, **new_args)
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher   File
> "/opt/stack/vitrage/vitrage/entity_graph/api_handler/entity_graph_api.py",
> line 120, in get_rca
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher
> direction=Direction.IN)
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher   File
> "/opt/stack/vitrage/vitrage/graph/algo_driver/networkx_algorithm.py", line
> 43, in graph_query_vertices
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher
> root_data = self.graph._g.node[root_id]
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher
> KeyError: u'ALARM:nagios:cloud:test'
> 2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher
> 2016-05-25 12:26:08.759 10742 ERROR oslo_messaging._drivers.common [-]
> Returning exception u'ALARM:nagios:cloud:test' to caller
>
> BR,
> dwj
>
>
>
> --------------------------------------------------------
>
> ZTE Information Security Notice: The information contained in this mail (and 
> any attachment transmitted herewith) is privileged and confidential and is 
> intended for the exclusive use of the addressee(s).  If you are not an 
> intended recipient, any disclosure, reproduction, distribution or other 
> dissemination or use of the information contained is strictly prohibited.  If 
> you have received this mail in error, please delete it and notify us 
> immediately.
>
>
>
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: [email protected]?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: [email protected]?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to