(oh, top-quoting...)

I did; the examples work when the module has no "." in the name.  IOW
this:

  "$(g.myroot)/pup" args => "--cfmodule -db server_machines.txt", module => 
"true", contain => in_dir($(g.myroot));

works: I can reference $(pup.dns_domain)

But this:

  "$(g.myroot)/pup.pl" args => "--cfmodule -db server_machines.txt", module => 
"true", contain => in_dir($(g.myroot));

does not.  The context in the latter case is "pup.pl" which I believe is
the problem, since "." is the namespace delimiter.  I also tried:

$(pup_pl.dns_domain)
$(pup.pup_pl.dns_domain)

but none worked.  As a suggestion, could the module execution take a
"namespace" string parameter so this is not an issue?  And could the
module namespace be converted to a legal namespace without "." or any
other illegal characters?

Thanks
Ted

Mark Burgess wrote:
> Check out tests/units/unit_module* in the source code.

On Tue, 22 Feb 2011 18:53:17 -0600 Ted Zlatanov <t...@lifelogs.com> wrote: 

TZ> I'm evaluating the community edition:
community> Cfengine - 3.1.4 Copyright (C) Cfengine AS 2008,2010-

TZ> I have a module that defines a variable:
community> Defined variable: dns_domain in context pup.pl with value: 
lifelogs.com

TZ> But I can't access it later.  Here's the config file I ran directly with
TZ> cf-agent:

TZ> body common control
TZ> {
TZ>   bundlesequence => { "g", "pup", "test" };
TZ>   inputs => { "cfengine_stdlib.cf" };
TZ> }

TZ> bundle common g
TZ> {
TZ> vars:
TZ>   "myroot" string => "/home/tzlatanov";
TZ> }

TZ> bundle agent pup
TZ> {
TZ> commands:
TZ>   # define all the pup.pl stuff in cfmodule format
TZ>   "$(g.myroot)/pup.pl" args => "--cfmodule -db server_machines.txt", module 
=> "true", contain => in_dir($(g.myroot));
TZ> }

TZ> bundle agent test
TZ> {
TZ> commands:
TZ>   "/bin/echo $(pup.pl.dns_domain)";
TZ> }

TZ> The output of pup.pl includes "=dns_domain=lifelogs.com" which triggers
TZ> the log message above, but I can't access that string using
TZ> ${pup.pl.dns_domain} or $(pup.pl.dns_domain).  I only get their literal
TZ> value:

-> Executing '/bin/echo $(pup.pl.dns_domain)' 
...(timeout=-678,owner=-1,group=-1)
TZ> Q: ".../bin/echo $(pup": $(pup.pl.dns_domain)
TZ> I: Last 1 quoted lines were generated by promiser "/bin/echo 
$(pup.pl.dns_domain)"
-> Completed execution of /bin/echo $(pup.pl.dns_domain)

TZ> The manual doesn't have an example, only a lateral mention that
TZ> module-defined variables are in a special context.  Is there a minimal
TZ> example of accessing variables in the module context I can see?

TZ> Thanks
TZ> Ted

-- 
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to