Many Thanks Thierry.

I figured out that the same applies for PathFilter with the "pass"
parameter. A rule containing a "pass" parameter means your command needs to
have this parameter no mater how it looks like.

Your advice with a second rule which is named differently works fine.

Many Thanks,

Kai




2014-07-09 11:34 GMT+02:00 Thierry Carrez <thie...@openstack.org>:

> Kai Brennenstuhl wrote:
> > I want to create a RegExpFilter (in nova/rootwrap.d) where the last
> > parameter is optional.
> > I can create a filter so that it works either with the last parameter or
> > without.
> > But I don't know how the rule has to look like so that the last
> > parameter is optional.
> >
> > Following is in my *.filters file:
> >
> > mycmd: RegExpFilter, /usr/local/bin/mycmd, root, mycmd, either|or,
> > anotherparam, .*
> > if I use the rule above there must be a 3rd parameter (no matter how it
> > looks like)
> >
> > However if I use the following I can't call  "mycmd" with a 3rd parameter
> > mycmd: RegExpFilter, /usr/local/bin/mycmd, root, mycmd, either|or,
> > anotherparam
> >
> > If I use both rules the first one is ignored.
> >
> > What should I change to have a rule with an optional parameter?
>
> RegExpFilter checks the number of parameters, so if you want to leverage
> RegExpFilter with an optional parameter you will have to write two
> separate rules.
>
> They have to be named differently though (mcmd1 and mycmd2 for example),
> otherwise the second one overwrites the first one.
>
> Regards,
>
> --
> Thierry Carrez (ttx)
>
> _______________________________________________
> Mailing list:
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> Post to     : openstack@lists.openstack.org
> Unsubscribe :
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>
_______________________________________________
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to     : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack

Reply via email to