ia64/xen-unstable

changeset 10161:956f7c5b1c1f

Added get_permissions implementation.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Tue May 23 16:14:49 2006 +0100 (2006-05-23)
parents 4c14bca8ca93
children d809359ab32d
files tools/python/xen/xend/xenstore/xstransact.py
line diff
     1.1 --- a/tools/python/xen/xend/xenstore/xstransact.py	Tue May 23 16:14:03 2006 +0100
     1.2 +++ b/tools/python/xen/xend/xenstore/xstransact.py	Tue May 23 16:14:49 2006 +0100
     1.3 @@ -221,6 +221,34 @@ class xstransact:
     1.4                  xshandle().mkdir(self.transaction, self.prependPath(key))
     1.5  
     1.6  
     1.7 +    def get_permissions(self, *args):
     1.8 +        """If no arguments are given, return the permissions at this
     1.9 +        transaction's path.  If one argument is given, treat that argument as
    1.10 +        a subpath to this transaction's path, and return the permissions at
    1.11 +        that path.  Otherwise, treat each argument as a subpath to this
    1.12 +        transaction's path, and return a list composed of the permissions at
    1.13 +        each of those instead.
    1.14 +        """
    1.15 +        if len(args) == 0:
    1.16 +            return xshandle().get_permissions(self.transaction, self.path)
    1.17 +        if len(args) == 1:
    1.18 +            return self._get_permissions(args[0])
    1.19 +        ret = []
    1.20 +        for key in args:
    1.21 +            ret.append(self._get_permissions(key))
    1.22 +        return ret
    1.23 +
    1.24 +
    1.25 +    def _get_permissions(self, key):
    1.26 +        path = self.prependPath(key)
    1.27 +        try:
    1.28 +            return xshandle().get_permissions(self.transaction, path)
    1.29 +        except RuntimeError, ex:
    1.30 +            raise RuntimeError(ex.args[0],
    1.31 +                               '%s, while getting permissions from %s' %
    1.32 +                               (ex.args[1], path))
    1.33 +
    1.34 +
    1.35      def set_permissions(self, *args):
    1.36          if len(args) == 0:
    1.37              raise TypeError