Redmine/6119

On 09/10/2014 05:45 PM, Edward Welbourne wrote:
>
> In tests/acceptance/00_basics/03_bodies/cf_null_in_bundlesequence.cf:
>
> > @@ -0,0 +1,16 @@
> > +body common control {
> > +    bundlesequence => { "cf_null", "test" };
>
> The case you describe is not an argument for having a "value that is 
> not a value" - it's an argument for using a list variable (which can 
> be empty, or supply a value, or even supply several) and interpolating it:
>
> |class1::
>     "var" slist => { "mybundle" };
>   !class1::
>     "var" slist => {};
>
>    any::
>      bundlesequence => { @(var), "test" };
> |
>
> (Note on replacing class2 with !class1: in your version, what should 
> happen if neither or both of class1 and class2 is defined ? I would 
> have a separate sub-list for each class and concatenate the various 
> lists into the bundlesequence.)
>
> If you maybe want to supply a value and maybe don't, a list is the 
> natural answer; it can have no entries, it can have one (and indeed it 
> could have more, if you wanted that).
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/cfengine/core/pull/1978/files#r17369132>.
>

Well, there is the case when you are reading data in from a file, and 
you want to distinguish between "" and cf_null, e.g.
when laying out a table

    var[1][2] -> "something"
    var[1][3] -> cf_null

I had a case like this in a table of IP addresses recently.


M





-- 
Founder and CTO at CFEngine
Author of In Search of Certainty: The Science of our Information 
Infrastructure <http://markburgess.org/certainty.html>