Hi Folks,

I am seeing this behavior on the the 3.1.0 release, where if I define
in a bundle some variables I can not use them later on in the same
bundle. The normal order should be vars then later the files right?
This might have been discussed on another thread that I missed --
tried to follow as many as possible. Has anyone seen this issue, or a
solution?

Any pointer are greatly appreciated
Best regards,
Gusto


Details:
  OS: Centos 5.5 x86_64
  Cfengine: gnu build in RPM version 3.1.0 final tar file.
  Use Case: I define in a agent bundle under vars the paths and server
strings/string lists for the paths and servers. This could be
something like your update.cf or just your failsafe.cf. When I run the
bundle does not see them. I had used this for my 3.0.5p1 configs (rpms
built on same server just release changed). During the beta I thought
this might have been the issue Neil spotted (
https://cfengine.com/bugtracker/view.php?id=334 ).

I took a copy of the unit_server_copy_remote.cf and added the vars to
show what I see.

NOTE: tester.server.com is defined as my network cf3 server. To
simplify this host is also acting as the server so there is no key
exchange complications.
##### ---------------------- Sample from the unit_test modified to
show issue ---------------------------
body common control
   {
      bundlesequence  => {
                         "testbundle"
                         };
   }

############################################
bundle agent testbundle
{

vars:
   linux::
    "master_test" string => "/var/cfmasterfiles/cf310dev/test/";
    "master_server" slist => { "tester.server.com" };

classes:
    "testdir" expression => isdir("/tmp/testcf310");

files:
  testdir::
    "/tmp/testcf310/somesample.txt"
       perms => system,
       copy_from =>
mycopy("$(master_server)/somesample.txt","$(master_server)"), #Does
not show all vars expanded.
       #copy_from =>
mycopy("$(master_server)/somesample.txt","tester.server.com"), #Does
not show all vars expanded.
       #copy_from =>
mycopy("/var/cfmasterfiles/cf310dev/test/somesample.txt","tester.server.com"),
#only way to get a copy moving.
       depth_search => recurse("inf"),
       classes  => repaired("got_somesample");

reports:
   testdir::
    "The test dir is there and we have that class";

   got_somesample::
    "Got the sample file";
}

############################################
body perms system
{
mode  => "0444";
}
#########################################################
body depth_search recurse(d)
{
depth => "$(d)";
}

#########################################################
body classes repaired(class)
{
  promise_repaired => { "$(class)" };
}

#########################################################
body copy_from mycopy(from,server)
{
source      => "$(from)";
#portnumber => "6789";
servers     => { "$(server)" , "failover1" };
copy_backup => "true";                   #/false/timestamp
stealth     => "true";                   #/on/false/off
preserve    => "true";
linkcopy_patterns => { ".*fish.*" };
copylink_patterns => { "non-local.*"};
xdev        => "true";                   # /on/false/off
compare     => "mtime";                  #
ctime/mtime/checksum/sum/byte/binary/any
link_type    => "absolute";              # /symbolic/relative/hard etc
type_check   => "true";
force_update => "false";
force_ipv4   => "false";
copy_size        => irange("0","50000");
trustkey    => "true";
encrypt     => "true";
verify      => "true";
#purge       => "false";
purge       => "true";
#findertype  => "MacOSX";
}
##### --------------------- Sample End ---------------------------

Running in debug 1 I see this:

Matched syntatically correct bundle (lval,rval) item = (perms) to its rval
Constraint syntax ok, but definition of body is elsewhere perms=s
Prepending scalar to rval-list [system]
CopyRvalItem(s)
   Appending Constraint: perms => system
Recorded LVAL copy_from
Found function identifier mycopy
Start FnCall mycopy args level 1
Appending scalar to rval-list [ $(master_server)/somesample.txt]
CopyRvalItem(s)
Appending scalar to rval-list [$(master_server)]
CopyRvalItem(s)
End args level 1
Installing Function Call mycopy
Installed mycopy( $(master_server)/somesample.txt,$(master_server),)
om,)

Running the server binary manually in foreground and with verbose I
also only see this connection when I don't use variables.
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to