Exemplo n.º 1
0
def test_for_s3_root():
    s = S3Stat.for_s3_root()
    eq_('DIRECTORY', s.type)
    eq_('S3', s.name)
    eq_('s3://', s.path)
    eq_(0, s.size)
    eq_(None, s.atime)
Exemplo n.º 2
0
def test_for_s3_root():
  s = S3Stat.for_s3_root()
  eq_('DIRECTORY', s.type)
  eq_('S3', s.name)
  eq_('s3://', s.path)
  eq_(0, s.size)
  eq_(None, s.atime)
Exemplo n.º 3
0
def test_for_s3_root():
    s = S3Stat.for_s3_root()
    eq_("DIRECTORY", s.type)
    eq_("S3A", s.name)
    eq_("s3a://", s.path)
    eq_(0, s.size)
    eq_(None, s.atime)
Exemplo n.º 4
0
  def _stats(self, path):
    if s3.is_root(path):
      return S3Stat.for_s3_root()

    try:
      key = self._get_key(path, validate=True)
    except BotoClientError, e:
      raise S3FileSystemException(_('Failed to access path "%s": %s') % (path, e.reason))
Exemplo n.º 5
0
    def _stats(self, path):
        if s3.is_root(path):
            return S3Stat.for_s3_root()

        try:
            key = self._get_key(path, validate=True)
        except S3ResponseError as e:
            if e.status == 404:
                return None
            else:
                exc_class, exc, tb = sys.exc_info()
                raise exc_class, exc, tb

        if key is None:
            key = self._get_key(path, validate=False)
        return self._stats_key(key)
Exemplo n.º 6
0
  def _stats(self, path):
    if s3.is_root(path):
      return S3Stat.for_s3_root()

    try:
      key = self._get_key(path, validate=True)
    except S3ResponseError as e:
      if e.status == 404:
        return None
      else:
        exc_class, exc, tb = sys.exc_info()
        raise exc_class, exc, tb

    if key is None:
      key = self._get_key(path, validate=False)
    return self._stats_key(key)
Exemplo n.º 7
0
  def _stats(self, path):
    if s3.is_root(path):
      return S3Stat.for_s3_root()

    try:
      key = self._get_key(path, validate=True)
    except S3ResponseError as e:
      if e.status == 404:
        return None
      elif e.status == 403:
        raise S3FileSystemException(_('User is not authorized to access path: "%s"') % path)
      else:
        raise S3FileSystemException(_('Failed to access path "%s": %s') % (path, e.reason))

    if key is None:
      key = self._get_key(path, validate=False)
    return self._stats_key(key)
Exemplo n.º 8
0
  def _stats(self, path):
    if s3.is_root(path):
      return S3Stat.for_s3_root()

    try:
      key = self._get_key(path, validate=True)
    except S3ResponseError as e:
      if e.status == 404:
        return None
      elif e.status == 403:
        raise S3FileSystemException(_('User is not authorized to access path: "%s"') % path)
      else:
        raise S3FileSystemException(_('Failed to access path "%s": %s') % (path, e.reason))

    if key is None:
      key = self._get_key(path, validate=False)
    return self._stats_key(key)
Exemplo n.º 9
0
  def _stats(self, path):
    if s3.is_root(path):
      return S3Stat.for_s3_root()

    try:
      key = self._get_key(path, validate=True)
    except BotoClientError as e:
      raise S3FileSystemException(_('Failed to access path "%s": %s') % (path, e.reason))
    except S3ResponseError as e:
      if e.status == 404:
        return None
      elif e.status == 403:
        raise S3FileSystemException(_('User is not authorized to access path: "%s"') % path)
      else:
        raise S3FileSystemException(_('Failed to access path "%s": %s') % (path, e.reason))
    except Exception as e: # SSL errors show up here, because they've been remapped in boto
      raise S3FileSystemException(_('Failed to access path "%s": %s') % (path, str(e)))
    if key is None:
      key = self._get_key(path, validate=False)
    return self._stats_key(key, self.fs)