On Tue, Jul 8, 2008 at 3:53 PM, Daniel J Walsh <dwalsh@xxxxxxxxxx> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Added flag to semanage to be able to import and export boolean files > into the current system. > [snip] > > + def modify(self, name, value=False, use_file=False): > + I think it is more idiomatic to use None instead of False when the argument is a value rather than just a boolean. > rc = semanage_begin_transaction(self.sh) > if rc < 0: > raise ValueError(_("Could not start semanage transaction")) > - > - rc = semanage_bool_set_active(self.sh, k, b) > - if rc < 0: > - raise ValueError(_("Could not set active value of boolean %s") % name) > - rc = semanage_bool_modify_local(self.sh, k, b) > - if rc < 0: > - raise ValueError(_("Could not modify boolean %s") % name) > + if use_file: And then "if use_file is not None:" here. > + fd = open(name) > + for b in fd.read().split(): > + bool, val = b.split("=") I think you need a little more error checking here. For example, if the b.split("=") resulted in less than two items the split into the two variables would fail, raising an exception. I think that we would want it to be both more tolerant to malformed files and provide better error reporting to the user. With those changes: Acked-by: Karl MacMillan <kmacmillan@xxxxxxxxxxxxxxxxx> -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with the words "unsubscribe selinux" without quotes as the message.