Forum: Cfengine Help
Subject: empty slist for zero-item expansion
Author: werkt
Link to topic: https://cfengine.com/forum/read.php?3,17951,17951#msg-17951
Trying to use the following somewhat simple syntax to define an empty list (in
reality I'm deciding between a set of definitions for this list dependent on
classes) results in 'cf3 Warning: Variable body for "empty_list" seems
incomplete'. Now, I could change the behavior for list parsing myself, but I
suppose its a bit of a philosophical question and I'd like it if someone could
weigh in. Should the following be valid syntax and a valid mechanism for
supporting iteration over an empty list (hence, zero-item expansion), or is
there another syntax I can use? Should there be an 'empty' keyword for valid
list assignment?
bundle agent myagent
{
vars:
"empty_list" slist => { };
"another_empty_list" slist;
commands:
"$(sys.workdir)/bin/$(empty_list)"; # should hopefully result in a zero-item
list's expansion, hence no execution
}
I've seen the ifdefined syntax for slist, allowing for expansion of other lists
depending on definition, which may be able to accomplish what I'm after, but
isn't this a more straightforward syntax to support no iteration? I'm also
making the assumption that the expander will support a zero list, if it is able
to get in as a variable definition...
Thanks,
-werkt
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine