summaryrefslogtreecommitdiffstats
path: root/glusterfs/gfapi.py
diff options
context:
space:
mode:
Diffstat (limited to 'glusterfs/gfapi.py')
-rwxr-xr-xglusterfs/gfapi.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/glusterfs/gfapi.py b/glusterfs/gfapi.py
index fc6bb27..2d51a96 100755
--- a/glusterfs/gfapi.py
+++ b/glusterfs/gfapi.py
@@ -65,6 +65,19 @@ class File(object):
raise OSError(err, os.strerror(err))
return ret
+ def fchmod(self, mode):
+ """
+ Change this file's mode
+
+ :param mode: new mode
+ :returns: 0 if success, raises OSError if it fails
+ """
+ ret = api.glfs_fchmod(self.fd, mode)
+ if ret < 0:
+ err = ctypes.get_errno()
+ raise OSError(err, os.strerror(err))
+ return ret
+
def fchown(self, uid, gid):
"""
Change this file's owner and group id
@@ -196,6 +209,20 @@ class Volume(object):
def mount(self):
return api.glfs_init(self.fs)
+ def chmod(self, path, mode):
+ """
+ Change mode of path
+
+ :param path: the item to be modified
+ :mode: new mode
+ :returns: 0 if success, raises OSError if it fails
+ """
+ ret = api.glfs_chmod(self.fs, path, mode)
+ if ret < 0:
+ err = ctypes.get_errno()
+ raise OSError(err, os.strerror(err))
+ return ret
+
def chown(self, path, uid, gid):
"""
Change owner and group id of path