Mailing List Archive

Added get_permissions implementation.
# HG changeset patch
# User emellor@leeni.uk.xensource.com
# Node ID 956f7c5b1c1f00d3f8e9d51c82670327027469e4
# Parent 4c14bca8ca93d9734bb888f26d2ac576e59c5b5a
Added get_permissions implementation.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
---
tools/python/xen/xend/xenstore/xstransact.py | 28 +++++++++++++++++++++++++++
1 files changed, 28 insertions(+)

diff -r 4c14bca8ca93 -r 956f7c5b1c1f tools/python/xen/xend/xenstore/xstransact.py
--- a/tools/python/xen/xend/xenstore/xstransact.py Tue May 23 16:14:03 2006 +0100
+++ b/tools/python/xen/xend/xenstore/xstransact.py Tue May 23 16:14:49 2006 +0100
@@ -221,6 +221,34 @@ class xstransact:
xshandle().mkdir(self.transaction, self.prependPath(key))


+ def get_permissions(self, *args):
+ """If no arguments are given, return the permissions at this
+ transaction's path. If one argument is given, treat that argument as
+ a subpath to this transaction's path, and return the permissions at
+ that path. Otherwise, treat each argument as a subpath to this
+ transaction's path, and return a list composed of the permissions at
+ each of those instead.
+ """
+ if len(args) == 0:
+ return xshandle().get_permissions(self.transaction, self.path)
+ if len(args) == 1:
+ return self._get_permissions(args[0])
+ ret = []
+ for key in args:
+ ret.append(self._get_permissions(key))
+ return ret
+
+
+ def _get_permissions(self, key):
+ path = self.prependPath(key)
+ try:
+ return xshandle().get_permissions(self.transaction, path)
+ except RuntimeError, ex:
+ raise RuntimeError(ex.args[0],
+ '%s, while getting permissions from %s' %
+ (ex.args[1], path))
+
+
def set_permissions(self, *args):
if len(args) == 0:
raise TypeError

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog