help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using nawk with cfengine


From: DRANSUTAVICIUS, CLAUDIO
Subject: Re: Using nawk with cfengine
Date: Fri, 18 Jun 2004 11:13:27 -0400

Hi John

I have tried your suggestion but I think it is gotten worse.
Here is the result:

ExecResult(/bin/ksh -c "/usr/bin/nawk '/domain/ { print toupper ($2) }'
/etc/resolv.conf")
Segmentation Fault(coredump)

There has to be a way of delimiting those brackets.

I'll keep plugin along.

Thanks



"Wheeler, John" wrote:

> Sorry, yep this won't help. ExecResult is not very friendly in this
> manner. I've had *some* luck with this idiom:
>
> ExecResult(/bin/ksh -c " your stuff here")
>
> this tends to prevent cfengine from puking.
>
> There was a relevant thread regarding the definition of an interpreter
> to "evaluate" expressions like you have, though I think something like
> the above will solve your problem.
>
> > -----Original Message-----
> > From: help-cfengine-bounces+jwheeler=eb.com@gnu.org
> [mailto:help-cfengine-
> > bounces+jwheeler=eb.com@gnu.org] On Behalf Of DRANSUTAVICIUS, CLAUDIO
> > Sent: Friday, June 18, 2004 8:00 AM
> > To: help-cfengine@gnu.org
> > Subject: Re: Using nawk with cfengine
> >
> > Hi John
> >
> > The trouble is  the open and close bracket of  ($2) not the actual
> > variable
> > $2
> > But may be I am wrong. Can you expand on the  ${dollar}  idea. I
> looked
> > on
> > the
> > link you provided but I am not to clear on this special variable.
> >
> > Thanks
> >
> > "Wheeler, John" wrote:
> >
> > > maybe ${dollar} is needed?
> > >
> > >
> http://www.cfengine.org/docs/cfengine-Reference.html#Special%20variables
> > >
> > > > -----Original Message-----
> > > > From: help-cfengine-bounces+jwheeler=eb.com@gnu.org
> > > [mailto:help-cfengine-
> > > > bounces+jwheeler=eb.com@gnu.org] On Behalf Of DRANSUTAVICIUS,
> CLAUDIO
> > > > Sent: Thursday, June 17, 2004 1:29 PM
> > > > To: help-cfengine@gnu.org
> > > > Subject: Using nawk with cfengine
> > > >
> > > >
> > > >
> > > > Hello
> > > >
> > > > I am trying to set up groups via domain name. The domainname is
> not
> > > > set and I can only find it in /etc/resolv.conf .
> > > >
> > > > Here is the code:
> > > >
> > > > control:
> > > >     FindDomain = ( ExecResult(/usr/bin/nawk '/domain/ { print
> toupper
> > > > ($2) }' /etc/resolv.conf) )
> > > >
> > > >     actionsequence = ( shellcommands  )
> > > >
> > > > groups:
> > > >
> > > >      West = ( Strcmp("WEST","${FindDomain}") )
> > > >
> > > > shellcommands:
> > > >         West::
> > > >                               "/usr/bin/echo - This is the Western
> > > > Domain $(FindDomain) "
> > > >         East::
> > > >                               "/usr/bin/echo - This is the Eastern
> > > > Domain $(FindDomain) "
> > > >
> > > >
> > > > The problem is when I try to convert from lower case to upper case
> in
> > > > the nawk it fails.
> > > > It does not like the ($2) cannot parse it properly.
> > > >
> > > > Here is results:
> > > >
> > > > /oss/opt/cfengine/bin/cfagent -q  -f NewTest.cf
> > > > cfengine::/oss/var/cfengine/inputs/NewTest.cf:3: Warning:
> Redefinition
> > > > of macro FindDomain=}' (or perhaps missing quote)
> > > > cfengine::/oss/var/cfengine/inputs/NewTest.cf:3: Warning:
> Redefinition
> > > > of macro FindDomain=/tmp/result) (or perhaps missing quote)
> > > >
> > > > Any help would be great.
> > > >
> > > > Thanks
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > Help-cfengine mailing list
> > > > Help-cfengine@gnu.org
> > > > http://lists.gnu.org/mailman/listinfo/help-cfengine
> >
> >
> >
> > _______________________________________________
> > Help-cfengine mailing list
> > Help-cfengine@gnu.org
> > http://lists.gnu.org/mailman/listinfo/help-cfengine






reply via email to

[Prev in Thread] Current Thread [Next in Thread]