[Openstack] [nova][oslo.rootwrap] RegExpFilter optional parameter

Kai Brennenstuhl kai.brennenstuhl at gmail.com
Wed Jul 9 10:46:26 UTC 2014


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 <thierry at 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 at lists.openstack.org
> Unsubscribe :
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20140709/f45135e6/attachment.html>


More information about the Openstack mailing list