[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using a filter in copy
From: |
Russell Adams |
Subject: |
Re: Using a filter in copy |
Date: |
Wed, 8 Oct 2003 16:49:00 -0500 |
User-agent: |
Mutt/1.4i |
Continuing issues when filtering a copy operation, I noticed that
regardless of the include/exclude parameters that all files in the
subdirectory I'm copying are checked by the filter.
I would have expected the behavior to be where the file list was first
reduced by the include/exclude parameters, then the remaining files
iterated through the filter.
Is that behavior updated in 2.1.0?
Russell
On Wed, Oct 08, 2003 at 10:38:38PM +0200, Mark.Burgess@iu.hio.no wrote:
>
> Thanks for pointing this out. Will fix for 2.1.0
>
> M
>
> On 8 Oct, Russell Adams wrote:
> > Ok, its quite simple really.
> >
> > The following code works:
> >
> > filters:
> >
> > { SigOk
> > ExecProgram: "/usr/bin/gpg -v $(this).asc"
> > Result: "Exec"
> > }
> >
> > Apparently in filter.c the results string uses "Exec" and not
> > "ExecProgram" by default.
> >
> > int FileObjectFilter(file,lstatptr,filterlist,context)
> >
> > ...
> >
> > if (fp->criteria[filterresult] == NULL)
> > {
> > fp->criteria[filterresult] =
> > strdup("Type.Owner.Group.Mode.Ctime.Mtime.Atime.Size.ExecRegex.NameRegex.IsSymLinkTo.Exec");
> > }
> >
> > Funny that the only reference to ExecProgram was in globals.c.
> >
> > Btw, I'm using 2.0.8-p1. ;]
> >
> > Russell
> >
> >
> > On Wed, Oct 08, 2003 at 11:40:27AM -0500, Russell Adams wrote:
> >> I'm trying to filter a copy command to selectively copy files, using
> >> ExecProgram in the filter.
> >>
> >> This code verifies that the files to be copied have valid signatures,
> >> otherwise it shouldn't copy them.
> >>
> >> I haven't had any luck with it so far, here's the excerpt from my
> >> code.
> >>
> >> filters:
> >>
> >> { SigOk
> >> #ExecProgram: "/bin/ls $(this)"
> >> ExecProgram: "/usr/bin/gpg -v $(this).asc"
> >> Result: "ExecProgram"
> >> }
> >>
> >> copy:
> >>
> >> $(workdir)/inputs/new/ dest=$(workdir)/inputs/
> >> include=cf*
> >> recurse=inf
> >> filter=SigOk
> >> mode=600
> >> owner=root
> >> group=root
> >>
> >> My understanding is that the copy portion selects a group of files to
> >> copy, then iterates through that list of files in the filter to
> >> identify which files are ok to copy, and which files to skip.
> >>
> >> Currently, the above skips every file.
> >>
> >> So long as the command issued with ExecProgram returns 0, the current
> >> $(this) should be copied. Obviously I've tried ls in addition to my
> >> signature verification. Neither works. I've tried omitting Result as
> >> well, and putting in a Type: "reg" into the chain. Still no luck.
> >>
> >> I've turned on debugging, and here's partial output from the
> >> filter. It looks like it returns 0 properly, and yet still fails to
> >> copy the file.
> >>
> >> FileObjectFilter(/var/cfengine/inputs/new/update.conf)
> >> Applying filter SigOk
> >> AddMacroValue(update.this=/var/cfengine/inputs/new/update.conf)
> >> Added Macro at hash address 667 to object update with value
> >> this=/var/cfengine/inputs/new/update.conf
> >> CompareMacro(this,this=/var/cfengine/inputs/new/update.conf)=this
> >> CompareMacro(this,this=/var/cfengine/inputs/new/update.conf)=this
> >> Executing filter command [/usr/bin/gpg -v
> >> /var/cfengine/inputs/new/update.conf.asc]
> >> gpg: armor header: Version: GnuPG v1.2.3 (GNU/Linux)
> >> gpg: assuming signed data in `/var/cfengine/inputs/new/update.conf'
> >> gpg: Signature made Tue Oct 7 16:37:24 2003 CDT using DSA key ID
> >> 0FD6CB55
> >> gpg: Good signature from "Russell Adams <rladams@kelsey-seybold.com>"
> >> gpg: binary signature, digest algorithm SHA1
> >> Shell command returned 0
> >> Prepending Exec
> >> Filter result on /var/cfengine/inputs/new/update.conf was 0
> >> IgnoreFile(update.conf.asc)
> >>
> >> I can't explain why the file was ignored when the command returned 0
> >> (successful), and I'd like to think its my syntax rather than a bug.
> >>
> >> Any input would be appreciated.
> >>
> >> Russell
> >>
> >>
> >> _______________________________________________
> >> Help-cfengine mailing list
> >> Help-cfengine@gnu.org
> >> http://mail.gnu.org/mailman/listinfo/help-cfengine
> >
> >
> > _______________________________________________
> > Help-cfengine mailing list
> > Help-cfengine@gnu.org
> > http://mail.gnu.org/mailman/listinfo/help-cfengine
>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Work: +47 22453272 Email: Mark.Burgess@iu.hio.no
> Fax : +47 22453205 WWW : http://www.iu.hio.no/~mark
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~