def __call__(self, parser, namespace, values, option_string=None): booleans = sepolicy.get_all_booleans() newval = getattr(namespace, self.dest) if not newval: newval = [] if isinstance(values, str): v = selinux.selinux_boolean_sub(values) if v not in booleans: raise ValueError("%s must be an SELinux process domain:\nValid domains: %s" % (v, ", ".join(booleans))) newval.append(v) setattr(namespace, self.dest, newval) else: for value in values: v = selinux.selinux_boolean_sub(value) if v not in booleans: raise ValueError("%s must be an SELinux boolean:\nValid boolean: %s" % (v, ", ".join(booleans))) newval.append(v) setattr(namespace, self.dest, newval)