> > > +++ b/lib/cmdlib/node.py
> > > @@ -359,7 +359,8 @@ class LUNodeAdd(LogicalUnit):
> > >          True, # from authorized keys
> > >          True, # from public keys
> > >          False, # clear authorized keys
> > > -        True) # clear public keys
> > > +        True, # clear public keys
> > > +        True) # it's a readd
> >
> > Nevertheless, in the long run, we should try to find a way to
> > limit the number positional arguments of the same type. But
> > refactorings are better done on master anyway, so no need
> > to change this patch.
> >
> 
> Sounds like an idea, but as far as I can see this is not supported at all
> for RPC definitions so far. I made it a named parameter in the backend
> function, but so far I cannot do anything about the RPC call.

As mentioned, refactorings are best done on master. But there definitely
are ways of reducing positionally passed falgs; for example, the standard
C-style of flag passing by bitwise encoding them into ints would work. I.e.,
one would have named constants 

FROM_AUTHORIZED_KEY=1
FROM_PUBLIC_KEYS=2
CLEAR_AUTHORIZED_KEYS=4
CLEAR_PUBLIC_KEYS=8
READD=16
...

and pass as a single flag argument something like

  FROM_AUTHORIZED_KEYS | FROM_PUBLIC_KEYS | CLEAR_PUBLIC_KEYS | READD

This might not be the best way, but it shows that we're not stuck to passing
lengthy True, True, False, ... argument lists.

Anyway, for a stable branch we should try to keep changes as small as possible,
so a new argument certainly is the way to go there. On master it might be worth
changing it eventually. There is, however, no hurry. One additional positionally
passed boolean won't get us into trouble. We just should not get into the habit
of extending these lists indefinitely.

Thanks,
Klaus

-- 
Klaus Aehlig
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Matthew Scott Sucherman, Paul Terence Manicle

Reply via email to