Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-3458

Easily define class if none in list of classes are defined

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: cf-agent
    • Labels:
    • Story Points:
      3

      Description

      Classes type promises currently provide several attribtues that take a list of classes to use as input.

      > $ cf-promises --syntax-description json | jq '.promiseTypes.classes.attributes[] | select(.type=="clist") | .attribute' 
      "and"
      "or"
      "select_class"
      "xor"
      

      Classes type promises do provide for not but it is singular.

      > $ cf-promises --syntax-description json | jq '.promiseTypes.classes.attributes[] | select(.type=="context") | .attribute'
      "expression"
      "not"
      

      It would be nice to be able to define a class based on a list of classes, expressions, or functions that evaluate to false like the opposite of and.

      For example:

      bundle agent __main__
      {
          classes:
            "all_true" and => { returnszero("/bin/true", noshell), "cfengine", "cfengine.cfengine_3" };
      
      @if feature(CFE_3458)
            "none_true" none => { returnszero("/bin/false", noshell), "Not_Defined", "cfengine.Not_Defined" };
      @endif
          reports:
            "all_true defined" if => "all_true";
            "none_true defined" if => "none_true";
      }
      
      R: all_true defined

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              a10042 Nick Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Summary Panel