Aleksey- The promise is to run the transformer, nothing more. Most transformers use $(this.promiser) as their input. For example, you could gzip the file if it existed, knowing that gzip would remove the plain file once it compressed the result (so effectively, you promise that if the file exists, you'll remove it). Another example is where you specify the _output_ file as the promised file, and then effectively _create_ the file if it didn't exist (sort of like a makefile). But the transformer can also do something to an unrelated file (like setting a marker if it does or doesn't see something).
However, the transormer does not implicitly act on the promised file - that must be explicitly specified if that is what you want. -Dan On May 15, 2011, at 10:30 PM, Aleksey Tsalolikhin wrote: > Hi. I need a working example of how to use a "transformer" to specify > a command to create the promised file based on a different origin > file. > > I looked at Reference Manual section "7.4.18 transformer" but could > not get a simpler example to work. > > Here is what I tried: > > bundle agent example { > > files: > "/tmp/aleksey.txt" > create => "true", # Must have this! > #transformer => "/bin/date"; > transformer => "/bin/cat /etc/passwd"; > } > > There are two ways to use a transformer, one with $(this.promiser), > one without. I am trying to use a transformer without this.promiser > > The file I want to create is "/tmp/aleksey.txt". Cfengine does create > this file - but it is zero bytes in size. > > If I run cf-agent with the -I switch, the output from the transformer > command is displayed. Shouldn't it go in the /tmp/aleksey.txt file? > > I don't know if I've hit a bug in Cfengine or if I just don't > understand how to use this attribute. > > Thanks, > Aleksey > _______________________________________________ > Help-cfengine mailing list > Help-cfengine@cfengine.org > https://cfengine.org/mailman/listinfo/help-cfengine _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine