help-cfengine
[Top][All Lists]
Advanced

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

Re: Setting variables based on classes in an imported file


From: Paul Krizak
Subject: Re: Setting variables based on classes in an imported file
Date: Thu, 16 Mar 2006 17:26:42 -0600
User-agent: Thunderbird 1.5 (X11/20051201)

As far as I know, cfengine does imports *last*. That means that despite your import statement being at the top of your file, cfgroups.conf isn't actually imported until after the containing file is parsed.

Luckily, imports *are* imported serially, so you can get around this restriction by adding yet another wrapper. For example:

update.conf:

import:
  any::
     cfgroups.conf
     real_update.conf

Then put all the "guts" of update.conf into real_update.conf. cfgroups.conf will then be processed before real_update.conf.

Paul Krizak                         5900 E. Ben White Blvd. MS 625
Advanced Micro Devices              Austin, TX  78741
Linux/Unix Systems Engineering      Phone: (512) 602-8775
Microprocessor Solutions Sector     Cell:  (512) 791-0686


Josh Smith wrote:
I'm trying to split my class definitions into a cfgroups.conf file, so
that my update.conf, cfagent.conf, and cfservd.conf files can all use the
same class definitions (by importing cfgroups.conf). Here are the
stripped-down essentials of what I have (and what's not working). update.conf has:

  import:
    any::
      cfgroups.conf

  control:
    any::
      AddInstallable = ( corp prod )
    corp::
      site = ( "needham" )
    prod::
      site = ( "watertown" )

  copy:
    any::
      /var/cfengine/mf/$(site)
        dest=/etc/site

cfgroups.conf has:

  groups:

    corp = ( machine1 )

    prod = ( machine1
             machine2
             machine3 )

When I try this configuration, cfagent throws an error:

  +$ sudo cfagent -q
cf:cfengine::/var/cfengine/inputs/update.conf:106: faculty/site undefined variable cf:cfengine::/var/cfengine/inputs/update.conf:106: faculty/site undefined variable cfengine::/var/cfengine/inputs/cfgroups.conf:Execution terminated after parsing due to errors in program

I'm not sure what the "faculty" business is about, as that doesn't appear
anywhere in any of my config files, but my interpretation is that cfagent
isn't parsing the variable definitions because the classes aren't defined,
despite my use of AddInstallable.

Is this in fact the right explanation? If so, is it the expected behavior? If so, is there any way to do what I'm trying to do here? My fallback is
to give up on importing cfgroups.conf, put the class definitions in
cfagent.conf, and make cfservd.conf and update.conf not use any
class-based logic.

                                      -Josh (josh@upromise.com)


_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine





reply via email to

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