On Mon, 19 Jan 2015 00:28:00 -0800 (PST) Stygge Krumpen <
styg...@gmail.com> wrote:
SK> Alas! - Methinks I have rejoiced prematurely:
SK> source:
SK> bundle agent MyTest {
SK> vars:
SK> "test" string => "one two three four";
SK> "stuff" string => nth(splitstring("$(test)", " ",9), 0);
SK> reports:
SK> "testreport: stuff($(stuff))";
SK> }
SK> output from 'cf-agent -KIlvv'
cf3> /default/MyTest/vars: Evaluating promise 'test'
cf3> /default/MyTest/vars: Evaluating promise 'stuff'
SK> {'one','two','three','four','0'})
SK> arg[0] range [a-zA-Z0-9_$(){}\[\].:]+ one
SK> arg[1] range .* two
SK> /default/MyTest/vars: Fatal CFEngine error: Bad arguments
CFEngine can't nest slist function calls (but it really should). You
have to make an intermediate variable:
#+begin_src cfengine3
body common control
{
bundlesequence => { run };
}
bundle agent run
{
vars:
"test" slist => splitstring("a:b:c", ":", 3);
"test0" string => nth("test", 0);
reports:
"The test list is $(test)";
"element #0 of the test list: $(test0)";
}
#+end_src