bug-cfengine
[Top][All Lists]
Advanced

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

DefineInGroup doesn't work even inside group


From: Dmitry Tarasov
Subject: DefineInGroup doesn't work even inside group
Date: Wed, 24 Nov 2004 01:34:09 +0200
User-agent: Mozilla Thunderbird 0.7 (X11/20040615)

Hi,

I have updated cfengine from 2.1.3 to 2.1.11 and found that cfagent produces "DefineInGroup used outside edit-group", but the DefineInGroup directive is located inside the BeginGroupIfNoMatch ..... EndGroup block. The following block did work ok before updating, but it doesn't work now.


Thanks



PROBLEM SCRIPT:

#!/usr/local/sbin/cfagent  -q -v   --inform -f

control:
AddInstallable  = ( nss_should_be_fixed nss_were_updated )
ifElapsed = ( 0  )
   actionsequence = ( editfiles shellcommands )

editfiles:
any::
   {
    /home/dias/cfe-test/etc/resolv.conf

LocateLineMatching  "^nameserver.*$"
BeginGroupIfNoMatch "^nameserver 11.11.11.11$"
       DefineInGroup "nss_should_be_fixed"
EndGroup
BeginGroupIfNotDefined "nss_should_be_fixed"
       IncrementPointer "1"
       BeginGroupIfNoMatch "^nameserver 22.22.22.22$"
               DefineInGroup "nss_should_be_fixed"
       EndGroup
EndGroup


DeleteLinesAfterThisMatching "^.*nameserver.*$"

BeginGroupIfDefined "nss_should_be_fixed"
       CatchAbort
       ResetSearch "1"
       DeleteLinesStarting "nameserver"
       GotoLastLine
       InsertLine "nameserver 11.11.11.11"
       InsertLine "nameserver 22.22.22.22"
EndGroup
DefineClasses "nss_were_updated"

   }



alerts:
   nss_were_updated::
        "NAMESERVERS WERE UPDATED !!!!!"

shellcommands:
   any::
   "/bin/cat /home/dias/cfe-test/etc/resolv.conf"
---------------------------------------------------------------------------------
OUTPUT:
engine::./test.cf:49: DefineInGroup used outside edit-group
cf:cfengine::./test.cf:49: DefineInGroup used outside edit-group
cfengine:: Executing script /bin/cat /home/dias/cfe-test/etc/resolv.conf...(timeout=0,uid=-1,gid=-1)
cfengine::/bin/cat /home/: nameserver 127.0.0.1
cfengine:: Finished script /bin/cat /home/dias/cfe-test/etc/resolv.conf

OUTPUT in verbose mode:

Begin editing /home/dias/cfe-test/etc/resolv.conf
Edit: Search ended at line 1
Edit: (Found nameserver 127.0.0.1)
(Begin Group - no match for ^nameserver 11.11.11.11$)
cf:cfengine::./test.cf:49: DefineInGroup used outside edit-group
(End Group)
(Begin Group - class nss_should_be_fixed not defined)
inc pointer failed, still at 1
(Begin Group - no match for ^nameserver 22.22.22.22$)
cf:cfengine::./test.cf:49: DefineInGroup used outside edit-group
(End Group)
(End Group)
(Begin Group - class nss_should_be_fixed not defined - skipping)
End editing /home/dias/cfe-test/etc/resolv.conf







reply via email to

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