Uploaded image for project: 'openATTIC'
  1. openATTIC
  2. OP-2303

Improve error reporting when the Salt REST API is unreachable

    XMLWordPrintable

    Details

    • Sprint:
      Sprint 24

      Description

      This is a followup top OP-2209. Currently, the oA backend creates the following backtrace when the Salt REST API can not be reached:

      2017-05-30 12:25:50,053 3613 mod_wsgi INFO requests.packages.urllib3.connectionpool#_new_conn - Starting new HTTP connection (1): salt
      2017-05-30 12:25:50,114 3613 mod_wsgi ERROR rest_client#post - Salt REST API failed POST, connection error
      2017-05-30 12:25:50,115 3613 mod_wsgi ERROR exception#custom_handler - Internal Server Error: None
      Traceback (most recent call last):
        File "/usr/lib/python2.7/site-packages/rest_framework/views.py", line 400, in dispatch
          response = handler(request, *args, **kwargs)
        File "/usr/lib/python2.7/site-packages/rest_framework/mixins.py", line 92, in list
          page = self.paginate_queryset(self.object_list)
        File "/usr/lib/python2.7/site-packages/rest_framework/generics.py", line 158, in paginate_queryset
          page_number = paginator.validate_number(page)
        File "/usr/lib/python2.7/site-packages/django/core/paginator.py", line 39, in validate_number
          if number > self.num_pages:
        File "/usr/lib/python2.7/site-packages/django/core/paginator.py", line 86, in _get_num_pages
          if self.count == 0 and not self.allow_empty_first_page:
        File "/usr/lib/python2.7/site-packages/django/core/paginator.py", line 72, in _get_count
          self._count = self.object_list.count()
        File "/usr/share/openattic/nodb/models.py", line 191, in count
          return len(self._filtered_data)
        File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 49, in __get__
          res = instance.__dict__[self.func.__name__] = self.func(instance)
        File "/usr/share/openattic/nodb/models.py", line 154, in _filtered_data
          filtered = [obj for obj in self._data()
        File "/usr/share/openattic/nodb/models.py", line 93, in _data
          objects = self.model.get_all_objects(context, query=self._query)
        File "/usr/share/openattic/ceph_deployment/models/ceph_minion.py", line 51, in get_all_objects
          minions = DeepSea.instance().get_minions()
        File "/usr/share/openattic/deepsea.py", line 98, in get_minions
          keys = self.key_list()
        File "/usr/share/openattic/rest_client.py", line 286, in func_wrapper
          return func(self, request=_Request("get", path, self, resp_structure))
        File "/usr/share/openattic/rest_client.py", line 235, in func_wrapper
          raise e
      RequestException: Salt REST API cannot be reached. Please check your configuration and that the API endpoint is accessible
      

      Basically, the only error we get is connection error, while there could be multiple reasons for this. If possible, we should convey a more detailed description of why the connection failed, e.g. connection refused, host not found, no route to host, as these give us a crucial hint about how to resolve the connection error,

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rdias Ricardo Dias
              Reporter:
              lgrimmer Grimmer, Lenz
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: