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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, September 22, 2005 3:50 PM To: [EMAIL PROTECTED] Cc: [email protected] 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 [EMAIL PROTECTED] 09/21/2005 09:18 AM To"David E. Nelson" <[EMAIL PROTECTED]> [EMAIL PROTECTED] 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 _______________________________________________ Help-cfengine mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-cfengine
