help-cfengine
[Top][All Lists]
Advanced

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

Using a filter in copy


From: Russell Adams
Subject: Using a filter in copy
Date: Wed, 8 Oct 2003 11:40:27 -0500
User-agent: Mutt/1.4i

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




reply via email to

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