Brian C. Hill wrote:

        Hi Dalibor,

        You can do this with AutoDefine (though I am having trouble
getting it work at the moment), but it still involves a little more
verbosity. You don't need to have individual copy statements w/ defines
for each file, but you do need a separate AutoDefine statement for each
one. It is am improvement, but it still makes a configuration look a
little busy.
OK. I've looked at the code a bit, and it seems like it could be possible to do the following:

In file image.c in function ImageCopy after the


         for (ptr = VAUTODEFINE; ptr != NULL; ptr=ptr->next)
            {
            if (strncmp(ptr->name,destfile,strlen(destfile)+1) == 0)
               {
snprintf(OUTPUT,CF_BUFSIZE*2,"cfengine: image %s was set to autodefine %s\n",ptr->name,ptr->classes);
               CfLog(cfinform,OUTPUT,"");
               AddMultipleClasses(ptr->classes);
               }
            }

block, one could add calls for AddMultipleClasses("copied_"+sourcefile) and/or "copied_+destfile", afaict, and have copied_* classes automatically defined for files that were successfully copied. That should allow one to do away with AutoDefines, right? Does that sound useful & correct? I haven't hacked on cfengine before, so I am just finding my ways around the source.

The other issue I'd be interested in would to see if there is a way to use regular expressions in classes, such that I can write a rule for all copied *.tar.gz files, for example. Is it possible already to write something like copied_*.tar.gz :: ? If not, how would one go about implementing something like IfCopied(*.tar.gz)?

cheers,
dalibor topic


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

Reply via email to