Thank you, Neil.
With your direction, I got this to work with the variables.cf. However, it is
quite a pain to create a slist variable with 150 elements. Is it possible to
read a file with a list of 150 folder names? I am sure that I can create a
script that creates this variable file but I am just hoping that Cfengine can
just read a list in a file.
Here are my cf files.
/tmp/templates/variables.cf
"bundle common inputVars
{
vars:
"paths" slist => {
"/tmp/test/create_folder1/create_folder2/." ,
"/tmp/test/create_folder1/create_folder3/." };
}"
/tmp/templates/create_local_folder_with_variables_on_file.cf
"# testing cfengine with the following:
# folder copy
# externaml variable file
#
body common control
{
bundlesequence => { createFolder(@(inputVars.paths)) };
ignore_missing_bundles => "true";
require_comments => "true";
inputs => { "/var/cfengine/inputs/cfengine_stdlib.cf"
, "/tmp/templates/variables.cf" };
version => "1.0";
}
body agent control
{
verbose => "true";
}
bundle agent createFolder(x)
{
files:
"$(x)"
comment => "create dir",
perms => mog("755", "root", "root"),
create => "true";
}"
Regards,
j
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of [email protected]
Sent: Wednesday, June 08, 2011 7:51 AM
To: [email protected]
Subject: Cfengine Help: Creating folders via input file or variable cf file
Forum: Cfengine Help
Subject: Re: Cfengine Help: Cannot copy files to remote host
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,22342,22395#msg-22395
Variables are scoped locally. Your call for the paths list in the bundle
createFolder expects a local variable in that bundle. That is where you should
create that list not in a separate bundle. If a variable is likely to be used
in multiple bundles then you can define the variable in the a common bundle.
Common variables are called via ${bundlename.variablename}.
Further reading:
http://www.cfengine.org/manuals/cf3-reference.html#List-variable-substitution-and-expansion
http://www.cfengine.org/manuals/cf3-tutorial.html#Scalar-variable-expansion
http://watson-wilson.ca/2011/05/managing-crontables-with-cfengine.html
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine