Skip to content

Commit

Permalink
Bump version.
Browse files Browse the repository at this point in the history
Also add logging to underlying authentication errors.
  • Loading branch information
mtth committed Oct 5, 2016
1 parent 0ee6a37 commit 043ee8c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion hdfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import logging as lg


__version__ = '2.0.11'
__version__ = '2.0.12'
__license__ = 'MIT'


Expand Down
22 changes: 11 additions & 11 deletions hdfs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def _on_error(response):
"""
if response.status_code == 401:
_logger.error(response.content)
raise HdfsError('Authentication failure. Check your credentials.')
try:
# Cf. http://hadoop.apache.org/docs/r1.0.4/webhdfs.html#Error+Responses
Expand Down Expand Up @@ -196,11 +197,11 @@ def _request(self, method, url, strict=True, **kwargs):
_mkdirs = _Request('PUT')
_open = _Request('GET', stream=True)
_rename = _Request('PUT')
_set_acl = _Request('PUT')
_set_owner = _Request('PUT')
_set_permission = _Request('PUT')
_set_replication = _Request('PUT')
_set_times = _Request('PUT')
_set_acl = _Request('PUT')

# Exposed endpoints

Expand Down Expand Up @@ -294,19 +295,18 @@ def acl_status(self, hdfs_path, strict=True):
res = self._get_acl_status(hdfs_path, strict=strict)
return res.json()['AclStatus'] if res else None

def set_acl(self, hdfs_path, aclspec):
"""Set ACL for specified path. Returns None for successful executions.
def set_acl(self, hdfs_path, acl_spec):
"""Set ACL for specified path.
:param hdfs_path: Path to an existing remote file or directory. An :class:`HdfsError`
will be raised if the path doesn't exist.
:param aclspec: String representation of an ACL spec. Must be a valid string with entries for user, group and other.
Ex: "user::rwx,user:foo:rw-,group::r--,other::---"
:param hdfs_path: Path to an existing remote file or directory. An
:class:`HdfsError` will be raised if the path doesn't exist.
:param acl_spec: String representation of an ACL spec. Must be a valid
string with entries for user, group and other. For example:
`"user::rwx,user:foo:rw-,group::r--,other::---"`.
"""
_logger.info(
'Setting ACLSPEC %r for %r.', aclspec, hdfs_path
)
self._set_acl(hdfs_path, aclspec=aclspec)
_logger.info('Setting ACL spec for %r to %r.', hdfs_path, acl_spec)
self._set_acl(hdfs_path, aclspec=acl_spec)

def parts(self, hdfs_path, parts=None, status=False):
"""Returns a dictionary of part-files corresponding to a path.
Expand Down

0 comments on commit 043ee8c

Please sign in to comment.