Forum: Cfengine Help
Subject: Re: Wildcard in files stanza on copy
Author: kholloway
Link to topic: https://cfengine.com/forum/read.php?3,17887,17900#msg-17900

Found a working solution but I have to think this is about the craziest 
possible way to accomplish what I want..
The splitstring is needed because the ls|grep combo seems to insert junk into 
the node names so splitting on the word boundary seems to work.
Someone has to have a better solution than this right?
Why does this need to be so complicated?

bundle agent test
{
      vars:
         "ls_out1"                      string => execresult("/usr/bin/ls 
/opt/base1/subdir |/usr/bin/grep -i 'node'","useshell");
         "vnode_names"                  slist => splitstring("$(ls_out1)", 
"\W", 5);

       files:
         solaris::
                "/opt/base1/subdir/${vnode_names}/subdir3/subdir4/myfiletocopy"
                   comment => "Very silly way to deal with an unknown 
subdirectory name",
                   copy_from => 
secure_cp("${my_actual_file_in_a_repo}","${g.cf3_server}");

}

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

Reply via email to