[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: autodefining classes of copied files
From: |
Dalibor Topic |
Subject: |
Re: autodefining classes of copied files |
Date: |
Thu, 09 Feb 2006 16:07:48 +0100 |
User-agent: |
Mozilla Thunderbird 1.0.6 (Macintosh/20050716) |
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