help-cfengine
[Top][All Lists]
Advanced

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

Re: module macros are expanded too late - was Determining Solaris patch


From: david . nelson
Subject: Re: module macros are expanded too late - was Determining Solaris patch revisions
Date: Thu, 22 Sep 2005 17:49:56 -0500


Hi Rader,

Shortly after emailing the list, I came up w/ a very similar script.  The only significant difference is that I report the lastest version since that is what is in affect.

But now I've run into another problem that I don't understand.

In 'actionsequence' I have listed 'actionsequence = ( module:showrev module:ods .... )' thinking that I'd have the macros immediately available. However, they don't appear to be.  Running cfagent in debug level #2, I'm getting the following around line 9045:

        IsLessThan(${patch_116548}, 4)" is evaluated and errors out w/ "${patch_116548} and  4 are NOT numerical

The above line is defined in the 'groups'/'classes' stanza.  Something else I don't understand is why are some variables defined in 'control:' and others in 'groups:' - does it matter?

It isn't until _way_ later (aound line 14778) that:

        AddMacroValue(main.patch_116548=3)
        ExpandVarstring(3)
        Added Macro at hash address 4102 to object main with value patch_116548=        3

Any ideas on getting around this problem?

Thanks,
         /\/elson



rader@ginseng.hep.wisc.edu

09/21/2005 09:18 AM

To
"David E. Nelson" <david.nelson@ni.com>
cc
Help-cfengine@gnu.org
Subject
Re: Determining Solaris patch revisions






> I was thinking of writing a module that would parse the output of 'showrev
>  -p',
> determine the latest rev and then for each patch print out:
>
> =patch_<patchrev>=<rev>
>
> For example:
>
> =patch_118558=3
>
> Numerical comparisons could then be used to determin if a rev was equal,
> greater, or less than.
>
> Any other ideas?

#!/usr/bin/perl -w
use strict;
open(IN,"showrev -p |");
while(<IN>) {
 if ( $_ =~ /^Patch: (\d+)\-(\d+)/ ) {
   print "=solaris_patchrev_$1=$2\n";
 }
}
close(IN);

...seems simple enough?

...but do you know what patches you care about in advance?  The set
of classes defined by the (any) module needs to be explictly defined
with addinstallable = ( )

steve
- - -
systems & network manager
high energy physics
university of wisconsin


reply via email to

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