Hi Nathan:

I'm not sure if this is it but I'll give it a stab. I think that class will only be defined if "yaddah" actually gets appended to somefile. If "yaddah" was already in the file I don't think the class will be created. Is that the problem?

-K

nathan r. hruby wrote:

Hi,

I have what's sure to be a simple question about the way import: works
with defined classes, yet, the simple answer eludes me.

I have in cfagent.conf:

import:
    any::
        main.cf


In main.cf I have:

control:
actionsequence = ( resolve disks disable processes copy links tidy files editfiles shellcommands )


classes:
    FirstRun        = ( FileExists(/.cfengine-needs-init) )

import:
        FirstRun.linux::
                linux.firstrun.cf
shellcommands:
    RestartSomeService::
        "restart command here"


In linux.firstrun.cf I have:

editfiles:
    { /somefile

    AppendIfNoSuchLine "yaddah"
    DefineClasses "RestartSomeService"
    }


Now, everything in the linux.firstrun.cf file gets done happily, except,
the classes it defines are not seen by the shellcommands: in main.cf, thus
SomeService is never restarted.


The docs state that variables and macros created in child imports are not
available in the parent files, does this also include Defined Classes?

If so, would the logical solution be to move the importation of
linux.firstrun.cf into the cfagent.conf file before main.cf?

This is cfengine 2.1.12 and 2.1.14.

Thanks for any help one could give!

-n




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

Reply via email to