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

Classes set in common bundles using variables on the RHS are not available early enough for dynamic inputs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.10.0
    • Component/s: Evaluation
    • Labels:
      None
    • Platform:
      Any
    • Steps to reproduce:
      Manual steps provided

      Description

      When a class is set in a common bundle and it uses a variable on the RHS it is not available early enough to enable dynamic inputs.

      In this example @group_one@ gets set if @$(variable)@ matches "vmware". This class is used in map_role_bundles to guard setting of variables for each role that specify the path to the policy file that role requires. This does not work unless I change from @strcmp($(variable), "vmware")@ to @strcmp("vmware", "vmware);

      bundle common classify
      #
      {
        vars:
            "variable" string => "vmware";
      
        classes:
            "group_one"
              expression => strcmp($(variable), "vmware"),
              comment => "Highest level classification, other classes depend on this.";
      }
      
      bundle common map_role_bundles
      #
      {
        vars:
          # Define bundles
          any::
            "role[app00_zero]"
              string => "$(this.promise_dirname)/apps/app00_zero.cf",
              comment =>
                "Roles are based on groups. Roles
                          map to bundles. Bundles are defined in a specific file.";
      
            "role[app_zero]"
              string => "$(this.promise_dirname)/apps/app_zero.cf",
              comment =>
                "Roles are based on groups. Roles
                          map to bundles. Bundles are defined in a specific file.";
          group_one::
            "role[app_one]"
              string => "$(this.promise_dirname)/apps/app_one.cf",
              comment =>
                "Roles are based on groups. Roles
                          map to bundles. Bundles are defined in a specific file.";
          group_none::
            "role[app_two]"
              string => "$(this.promise_dirname)/apps/app_two.cf";
      
          any::
            "inputs" slist => getvalues(role);
            "bundles" slist => getindices(role);
      }
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel