Check out tests/units/unit_module* in the source code.
On 02/23/2011 01:53 AM, Ted Zlatanov wrote: > I'm evaluating the community edition: > community> Cfengine - 3.1.4 Copyright (C) Cfengine AS 2008,2010- > > I have a module that defines a variable: > community> Defined variable: dns_domain in context pup.pl with value: > lifelogs.com > > But I can't access it later. Here's the config file I ran directly with > cf-agent: > > body common control > { > bundlesequence => { "g", "pup", "test" }; > inputs => { "cfengine_stdlib.cf" }; > } > > bundle common g > { > vars: > "myroot" string => "/home/tzlatanov"; > } > > bundle agent pup > { > commands: > # define all the pup.pl stuff in cfmodule format > "$(g.myroot)/pup.pl" args => "--cfmodule -db server_machines.txt", module > => "true", contain => in_dir($(g.myroot)); > } > > bundle agent test > { > commands: > "/bin/echo $(pup.pl.dns_domain)"; > } > > The output of pup.pl includes "=dns_domain=lifelogs.com" which triggers > the log message above, but I can't access that string using > ${pup.pl.dns_domain} or $(pup.pl.dns_domain). I only get their literal > value: > > -> Executing '/bin/echo $(pup.pl.dns_domain)' > ...(timeout=-678,owner=-1,group=-1) > Q: ".../bin/echo $(pup": $(pup.pl.dns_domain) > I: Last 1 quoted lines were generated by promiser "/bin/echo > $(pup.pl.dns_domain)" > -> Completed execution of /bin/echo $(pup.pl.dns_domain) > > The manual doesn't have an example, only a lateral mention that > module-defined variables are in a special context. Is there a minimal > example of accessing variables in the module context I can see? > > Thanks > Ted > _______________________________________________ > 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