On Thu, 02 Aug 2012 09:18:02 -0400 Ted Zlatanov <t...@lifelogs.com> wrote: 

TZ> On Thu, 2 Aug 2012 00:22:35 -0500 Diego Zamboni <di...@zzamboni.org> wrote: 
>>> Yup.  Perhaps it could be returned by splitstring() instead of { "" }?

DZ> Bug report time, I guess :)

TZ> I reported it:

TZ> https://cfengine.com/bugtracker/view.php?id=1273

Testing the 3.4.0 defaults promise type, I found some puzzling
behavior relating to slists.  My question is, how would I ever get the
defaults to kick in for an slist, if emptiness doesn't do it?  The
manual doesn't say.

I would actually really like more fine-grained behavior here for
defaults of lists.  Ideally I'd be able to specify:

1) values that should always be in the list (like if_match_regex for
string defaults, this could be if_match_regex across the list)

2) values that should never be in the list (invert if_match_regex across
the list)

3) min/max size of the list (min_size and max_size maybe?)

Is any of this worth a bug report or feature request?  I can live
without these things, but they would be nice, especially for Design
Center work :)

Thanks
Ted

body common control
{
      bundlesequence => { "example" };
}

bundle agent example
{
  vars:
      "not_empty1" slist => splitstring("", "", 100);
      "not_empty2" slist => { "cf_null" };
      "not_empty3" slist => { readstringlist("/nonesuch", "", "", 1, 1) };
  defaults:
      "not_empty1" slist => { "not", "empty" };
      "not_empty2" slist => { "not", "empty" };
      "not_empty3" slist => { "not", "empty" };
  reports:
    cfengine_3::
      "Not empty1, huh?  '$(not_empty1)'";
      "Not empty2, huh?  '$(not_empty2)'";
      "Not empty3, huh?  '$(not_empty3)'";
}

=>

% cf-agent -K -f /tmp/test.cf
R: Not empty1, huh?  ''
R: Not empty3, huh?  '$(not_empty3)'

% cf-agent --version|grep Core    
 @ @@@ @    CFEngine Core 3.4.0b1.26c0c5f
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to