On Fri, 2009-03-06 at 12:51 +0000, Martin Sivák wrote: > storage/devicelibs/crypto.py | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > New commits: > commit 0b65aca74899a558d14d1e305bb98380be185dfc > Author: Martin Sivak <msivak@xxxxxxxxxx> > Date: Fri Mar 6 12:20:07 2009 +0100 > > Do not pass None values into nonmandatory arguments, you are screwing the default values.. This kind of thing is usually handled in the function/method being called. Since you know that there must be a cipher and key size, you simply supply the defaults if the provided values are None. Callers should not have to manage this type of thing. Dave > > diff --git a/storage/devicelibs/crypto.py b/storage/devicelibs/crypto.py > index be919ff..28da47c 100644 > --- a/storage/devicelibs/crypto.py > +++ b/storage/devicelibs/crypto.py > @@ -62,7 +62,15 @@ def luks_format(device, > else: > raise ValueError("luks_format requires either a passphrase or a key file") > > - rc = cs.luksFormat(device = device, cipher = cipher, keysize = key_size, keyfile = key_file) > + #None is not considered as default value and pycryptsetup doesn't accept it > + #so we need to filter out all Nones > + kwargs = {} > + kwargs["device"] = device > + if cipher: kwargs["cipher"] = cipher > + if key_file: kwargs["keyfile"] = key_file > + if key_size: kwargs["keysize"] = key_size > + > + rc = cs.luksFormat(**kwargs) > if key_file_unlink: os.unlink(key_file) > > if rc: > > > _______________________________________________ > anaconda-commits-list mailing list > anaconda-commits-list@xxxxxxxxxx > http://post-office.corp.redhat.com/mailman/listinfo/anaconda-commits-list _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list