help-cfengine
[Top][All Lists]
Advanced

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

Using nawk with cfengine


From: DRANSUTAVICIUS, CLAUDIO
Subject: Using nawk with cfengine
Date: Thu, 17 Jun 2004 14:28:32 -0400


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






reply via email to

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