original_docstring: Call a glance client method.
  
          If we get a connection error,
          retry the request according to CONF.glance_num_retries.
  
          :param context: The request context, for access checks.
          :param version: The requested API version.v
          :param method: The method requested to be called.
          :param args: A list of positional arguments for the method called
          :param kwargs: A dict of keyword arguments for the method called
  
          :raises: GlanceConnectionFailed
          
docstring: Call a glance client method.
  If we get a connection error,
  retry the request according to CONF.glance_num_retries.
docstring_tokens: Call a glance client method . If we get a connection error retry the request according to CONF . glance_num_retries .
code: def call(self, method, *args, **kwargs):
          """Call a glance client method.
  
          If we get a connection error,
          retry the request according to CONF.glance_num_retries.
  
          :param context: The request context, for access checks.
          :param version: The requested API version.v
          :param method: The method requested to be called.
          :param args: A list of positional arguments for the method called
          :param kwargs: A dict of keyword arguments for the method called
  
          :raises: GlanceConnectionFailed
          """
          retry_excs = (glance_exc.ServiceUnavailable,
                        glance_exc.InvalidEndpoint,
                        glance_exc.CommunicationError)
          image_excs = (glance_exc.Forbidden,
                        glance_exc.Unauthorized,
                        glance_exc.NotFound,
                        glance_exc.BadRequest)
          num_attempts = 1 + CONF.glance.glance_num_retries
  
          # TODO(pas-ha) use retrying lib here
          for attempt in range(1, num_attempts + 1):
              try:
                  return getattr(self.client.images, method)(*args, **kwargs)
              except retry_excs as e:
                  error_msg = ("Error contacting glance server "
                               "'%(endpoint)s' for '%(method)s', attempt"
                               " %(attempt)s of %(num_attempts)s failed.")
                  LOG.exception(error_msg, {'endpoint': self.endpoint,
                                            'num_attempts': num_attempts,
                                            'attempt': attempt,
                                            'method': method})
                  if attempt == num_attempts:
                      raise exception.GlanceConnectionFailed(
                          endpoint=self.endpoint, reason=str(e))
                  time.sleep(1)
              except image_excs as e:
                  exc_type, exc_value, exc_trace = sys.exc_info()
                  new_exc = _translate_image_exception(
                      args[0], exc_value)
                  six.reraise(type(new_exc), new_exc, exc_trace)
code_tokens: def call ( self , method , * args , ** kwargs ) : retry_excs = ( glance_exc . ServiceUnavailable , glance_exc . InvalidEndpoint , glance_exc . CommunicationError ) image_excs = ( glance_exc . Forbidden , glance_exc . Unauthorized , glance_exc . NotFound , glance_exc . BadRequest ) num_attempts = 1 + CONF . glance . glance_num_retries for attempt in range ( 1 , num_attempts + 1 ) : try : return getattr ( self . client . images , method ) ( * args , ** kwargs ) except retry_excs as e : error_msg = ( "Error contacting glance server " "'%(endpoint)s' for '%(method)s', attempt" " %(attempt)s of %(num_attempts)s failed." ) LOG . exception ( error_msg , { 'endpoint' : self . endpoint , 'num_attempts' : num_attempts , 'attempt' : attempt , 'method' : method } ) if attempt == num_attempts : raise exception . GlanceConnectionFailed ( endpoint = self . endpoint , reason = str ( e ) ) time . sleep ( 1 ) except image_excs as e : exc_type , exc_value , exc_trace = sys . exc_info ( ) new_exc = _translate_image_exception ( args [ 0 ] , exc_value ) six . reraise ( type ( new_exc ) , new_exc , exc_trace )
short_docstring: Call a glance client method.
short_docstring_tokens: Call a glance client method .
comment: """Call a glance client method.
  
          If we get a connection error,
          retry the request according to CONF.glance_num_retries.
  
          :param context: The request context, for access checks.
          :param version: The requested API version.v
          :param method: The method requested to be called.
          :param args: A list of positional arguments for the method called
          :param kwargs: A dict of keyword arguments for the method called
  
          :raises: GlanceConnectionFailed
          """$SEP$# TODO(pas-ha) use retrying lib here