[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: feature request
From: |
GERMA Denis |
Subject: |
Re: feature request |
Date: |
Wed, 18 Apr 2001 19:22:07 +0200 |
Hi,
I am surprise but I tried to use the ! operator on the 1.6.3 version of
cfengine
on a test programe :
>classes:
>
> classe1 = ( '/usr/bin/test -f classe1' )
> not_classe1 = ( !classe1 )
And cfengine complains :
"Wildcards cannot be used in this context:" on the "not_classe1" line.
I would have used in the same spirit the "and" operator in the classe
definition,
but it does not seems possible yet.
In fact I would have been a good Idea to be able to use all logical operations
on classe constructions.
Have I missed something ?
I have joined a start for a test program.
run cfengine on it and all lines should be duplicated.
Thanks for all.
D.Germa
Mark.Burgess@iu.hio.no a écrit :
> On 17 Apr, Alan Sparks wrote:
> > Don't know how hard this would be to implement -- so I'll ask anyway...
> >
> > Several times I've run into the need for a class representing "run these
> > if no other class applies." Something like:
> >
> > resolve:
> > box1||box2::
> > 1.2.3.4
> > default::
> > 4.3.2.1
> >
> > I just made "default" up... the idea is the "default" class applies if
> > no other more specific classes apply. I know something like this
> > behavior can be synthesized by using class defs and negated classes, but
> > it is extremely cumbersome to do.
> >
> > I don't think "any" is any good here, since it would be executed
> > regardless of whether other rules apply.
> >
> > Opinions?
> > -Alan
> >
>
> I don't see what is difficult about using the ! sign. Figuring
> out what is "default" is much easier for you than for cfengine.
> You could do this:
>
> classes:
>
> someclass = ( box1 box 2 )
> default = ( !someclass )
>
> resolve:
>
> someclass::
> 1.2.3.4
>
> default:
>
> 1.2.3.4
>
> if you want to make it more readable.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Work: +47 22453272 Email: Mark.Burgess@iu.hio.no
> Fax : +47 22453205 WWW : http://www.iu.hio.no/~mark
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-cfengine
control:
linux::
actionsequence =
(
shellcommands
)
# domain = ( fty.cstelecom.com )
domain = ( my_domain )
classes:
classe1 = ( '/usr/bin/test -f classe1' )
classe2 = ( '/usr/bin/test -f classe2' )
classe3 = ( '/usr/bin/test -f classe3' )
classe4 = ( '/usr/bin/test -f classe4' )
classe1_and_classe2 = ( classe1.classe2 )
#classe1_and_not_classe2 = ( classe1.!classe2 )
#not_classe1_and_classe2 = ( !classe1.classe2 )
#not_classe1_and_not_classe2 = ( !classe1.!classe2 )
classe1_and_classe3 = ( classe1.classe3 )
#classe1_and_not_classe3 = ( classe1.!classe3 )
#not_classe1_and_classe3 = ( !classe1.classe3 )
#not_classe1_and_not_classe3 = ( !classe1.!classe3 )
#not_classe1 = ( !classe1 )
#not_classe2 = ( !classe2 )
#not_classe3 = ( !classe3 )
#not_classe4 = ( !classe4 )
shellcommands:
linux::
"/usr/bin/touch classe1"
"/usr/bin/touch classe2"
"/bin/rm -f classe3"
"/bin/rm -f classe4"
linux.classe1::
"/bin/echo classe1 OK"
linux.classe2::
"/bin/echo classe2 OK"
linux.classe3::
"/bin/echo classe3 NOK"
linux.classe4::
"/bin/echo classe4 NOK"
linux.!classe1::
"/bin/echo !classe1 NOK"
linux.!classe2::
"/bin/echo !classe2 NOK"
linux.!classe3::
"/bin/echo !classe3 OK"
linux.!classe4::
"/bin/echo !classe4 OK"
linux.not_classe1::
"/bin/echo !classe1 NOK"
linux.not_classe2::
"/bin/echo !classe2 NOK"
linux.not_classe3::
"/bin/echo !classe3 OK"
linux.not_classe4::
"/bin/echo !classe4 OK"
linux.classe1_and_classe2::
"/bin/echo classe1.classe2 OK"
linux.classe1_and_not_classe2::
"/bin/echo classe1.!classe2 NOK"
linux.not_classe1_and_classe2::
"/bin/echo !classe1.classe2 NOK"
linux.not_classe1_and_not_classe2::
"/bin/echo !classe1.!classe2 NOK"
linux.classe1.classe2::
"/bin/echo classe1.classe2 OK"
linux.classe1.!classe2::
"/bin/echo classe1.!classe2 NOK"
linux.!classe1.classe2::
"/bin/echo !classe1.classe2 NOK"
linux.!classe1.!classe2::
"/bin/echo !classe1.!classe2 NOK"
linux.classe1_and_classe3::
"/bin/echo classe1.classe3 NOK"
linux.classe1_and_not_classe3::
"/bin/echo classe1.!classe3 OK"
linux.not_classe1_and_classe3::
"/bin/echo !classe1.classe3 NOK"
linux.not_classe1_and_not_classe3::
"/bin/echo !classe1.!classe3 NOK"
linux.classe1.classe3::
"/bin/echo classe1.classe3 NOK"
linux.classe1.!classe3::
"/bin/echo classe1.!classe3 OK"
linux.!classe1.classe3::
"/bin/echo !classe1.classe3 NOK"
linux.!classe1.!classe3::
"/bin/echo !classe1.!classe3 NOK"