def _try_mandatory(t, env, path): c = env.c1 mandatory = [attr.bitnum for attr in env.attr_info if attr.mandatory] # don't expect rdattr_error to be a part of returned attributes mandatory.remove(get_attrbitnum_dict()['rdattr_error']) ops = c.use_obj(path) ops += [c.getattr(mandatory)] res = c.compound(ops) check(res) attrs = res.resarray[-1].obj_attributes unsupp = [get_attr_name(a) for a in mandatory if a not in attrs] if unsupp: t.fail("Mandatory attribute(s) %s not supported" % 'and'.join(unsupp))
def do_getattr(self, line): """Get regular attributes""" argv = line.split() object = argv[0] attributes = argv[1:] attrlist = [] dict = nfs4lib.get_attrbitnum_dict() for attr in attributes: if attr.isdigit() == 1: attrlist.append(attr.atoi()) elif dict.has_key(attr): attrlist.append(dict[attr]) pathcomps = self.ncl.get_pathcomps_rel(object) lookupops = self.ncl.lookup_path(pathcomps) operations = [self.ncl.putrootfh_op()] + lookupops operations.append( self.ncl.getattr_op(nfs4lib.list2attrmask(attrlist))) try: res = self.ncl.compound(operations) except nfs4lib.BadCompoundRes, result: print "getattr failed: ", result return
def __init__(self, name, access, sample): self.name = name self.bitnum = get_attrbitnum_dict()[name] self.mask = 2**self.bitnum self.access = access self.sample = sample