help-cfengine
[Top][All Lists]
Advanced

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

RE: DefineClasses in editfiles


From: Wheeler, John
Subject: RE: DefineClasses in editfiles
Date: Tue, 1 Jun 2004 10:26:45 -0500

Inline.

> -----Original Message-----
> From: address@hidden
[mailto:help-cfengine-
> address@hidden On Behalf Of Steve Wray
> Sent: Sunday, May 30, 2004 11:11 PM
> To: address@hidden
> Subject: DefineClasses in editfiles
> 
> I need to run a shellcommand to unzip a file,
> then an editfiles to edit contents of something in that file,
> then another shellcommand to zip it up again.
> 
> Like this;
> 
> shellcommands:
>    Mozilla_Update::
>       "/usr/bin/unzip US.jar"
>       chdir=/usr/lib/mozilla-firefox/chrome
>       define=Mozilla_Ready_To_Edit
> 
> then
> 
> editfiles:
>    Mozilla_Ready_To_Edit::
>    # Having unzipped the darn thing we can now edit it
>    { /usr/lib/mozilla-firefox/chrome/locale/US/browser-
> region/region.properties
>       ReplaceAll "^homePageDefault=.*mozilla.*$" With
> "homePageDefault=http://intranet";
>       ReplaceAll "^browser.startup.homepage=.*mozilla.*$" With
> "browser.startup.homepage=http://intranet";
>       ReplaceAll "^browser.throbber.url=.*mozilla.*$" With
> "browser.throbber.url=http://intranet";
>       ReplaceAll "^startup.homepage_override_url=.*mozilla.*$" With
> "startup.homepage_override_url=http://intranet";
>       # and once its edited we are ready to zip it back up:
>       DefineClasses "Mozilla_Ready_To_Zip"
>    }
> 
> then
> 
> shellcommands:
>    Mozilla_Ready_To_Zip::
>       "/usr/bin/zip -rm US.jar locale"
>       chdir=/usr/lib/mozilla-firefox/chrome
> 
> I've tried this with the two shell commands in one shellcommands
> definition,
> and seperately like I show here.
> 
> The control section looks like this;
> 
>    actionsequence = ( shellcommands editfiles shellcommands  )

try 

actionsequence = ( 
    shellcommands.Mozilla_Update
    editfiles.Mozilla_Ready_To_Edit
    shellcommands.Mozilla_Ready_To_Zip
    )



This forces each action to executed, but ignores the dependencies you've
setup, therefore if a previous step fails, your next step will run
anyway. You can still have the dependencies by adding yet another class
like:

actionsequence = ( 
    shellcommands.step1
    editfiles.step2
    shellcommands.step3
    )

then modify your action statements:

 shellcommands:
    Mozilla_Update.step1::
       "/usr/bin/unzip US.jar"
       chdir=/usr/lib/mozilla-firefox/chrome
       define=Mozilla_Ready_To_Edit

    Mozilla_Ready_To_Zip.step3::
       "/usr/bin/zip -rm US.jar locale"
       chdir=/usr/lib/mozilla-firefox/chrome


(similar modification to the editfiles)

I use this syntax all over, my action sequences are huge, but I also
know *when* things are going to happen.

oh... also, you may be able to do what you want with what you have
already if you do an: 

AddInstallable

http://www.iu.hio.no/cfengine/docs/cfengine-Reference.html#addinstallabl
e



my guess is that the class bracketed action items are being thrown away
at parse time without addinstallable.


> 
> Yet
> # cfagent -K -v -DMozilla_Update
> does the first shellcommand, does the editfiles and does not do the
second
> shellcommand.
> 
> It looks as if the
> DefineClasses "Mozilla_Ready_To_Zip"
> does't actually define the class.
> (I've tried with and without the quotes).
> 
> The documentation says;
> 
> DefineClasses "class1:class2:..."
>     Activate the following colon, comma or dot-separated list of
classes
> if and only if the file is edited.
> 
> Any suggestions?
> 
> Thanks!
> 
> 
> _______________________________________________
> Help-cfengine mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-cfengine
> 






reply via email to

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