[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: module macros are expanded too late - was Determining Solaris patch
From: |
Martin, Jason H |
Subject: |
RE: module macros are expanded too late - was Determining Solaris patch revisions |
Date: |
Thu, 22 Sep 2005 16:01:21 -0700 |
If you are having problems with your module's classes and actions being
set too late, try putting it in a PrepModule line. That causes it to
happen at parse time.
No variables are defined in the Classes: section, only classes. Control
is where variables get assigned.
-Jason Martin
-----Original Message-----
From: help-cfengine-bounces+jason.h.martin=cingular.com@gnu.org
[mailto:help-cfengine-bounces+jason.h.martin=cingular.com@gnu.org] On
Behalf Of david.nelson@ni.com
Sent: Thursday, September 22, 2005 3:50 PM
To: rader@ginseng.hep.wisc.edu
Cc: Help-cfengine@gnu.org
Subject: Re: module macros are expanded too late - was Determining
Solaris patch revisions
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>
ccHelp-cfengine@gnu.org
SubjectRe: 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
- RE: module macros are expanded too late - was Determining Solaris patch revisions,
Martin, Jason H <=