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

Policy files in services/autorun should not be parsed and pre-evaluated unless the services_autorun class is set

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 3.7.0, 3.8.1, 3.7.1, 3.7.3, 3.7.2, 3.8.0, 3.8.2
    • Fix Version/s: 3.9.0
    • Component/s: None
    • Labels:
      None

      Description

      Currently the masterfiles policy framework parses all policy files (*.cf) found in @services/autorun@. These files are parsed even if the @services_autorun@ class NOT defined.

      Here is example output when the @services_autorun@ class is defined.

      @cf-agent -Kf ./promises.cf -v | egrep "services_autorun|autorun/hello.cf"@

      In the following output note the @services_autorun@ class gets defined, also note that @services/autorun/hello.cf@ was parsed. The @services_autorun@ class was defined because it was in @def.json@.

      <pre>
      verbose: Begin Parsing file '/home/nickanderson/CFEngine/masterfiles/./services/autorun/hello.cf'
      verbose: End Parsing file '/home/nickanderson/CFEngine/masterfiles/./services/autorun/hello.cf'
      verbose: Using bundlesequence =>

      {'inventory_control','inventory_control','inventory_any','inventory_autorun','inventory_linux','inventory_lsb','inventory_debian','inventory_os','def','cfengine_enterprise_hub_ha','cfsketch_run','services_autorun','autorun','cfe_internal_management','main','cfengine_enterprise_hub_ha'}
      verbose: C: + Global class: services_autorun
      verbose: Skipping evaluation of classes promise as class 'services_autorun' is already set
      verbose: Skipping evaluation of classes promise as class 'services_autorun' is already set
      verbose: Skipping evaluation of classes promise as class 'services_autorun' is already set
      verbose: Skipping evaluation of classes promise as class 'services_autorun' is already set
      verbose: Skipping evaluation of classes promise as class 'services_autorun' is already set
      verbose: Skipping evaluation of classes promise as class 'services_autorun' is already set
      verbose: Skipping evaluation of classes promise as class 'services_autorun' is already set
      verbose: Skipping evaluation of classes promise as class 'services_autorun' is already set
      verbose: Skipping evaluation of classes promise as class 'services_autorun' is already set
      verbose: Skipping evaluation of classes promise as class 'services_autorun' is already set
      verbose: Skipping evaluation of classes promise as class 'services_autorun' is already set
      verbose: B: BEGIN bundle services_autorun
      verbose: A: Bundle Accounting Summary for 'services_autorun' in namespace default
      verbose: A: Zero promises executed for bundle 'services_autorun'
      verbose: B: END bundle services_autorun
      verbose: P: Base context class: services_autorun
      </pre>

      After removing @def.json@ so that the @services_autorun@ class does not get defined this is the output from the same command. Note that @services_autorun@ is not defined, but that @hello.cf@ is still parsed.

      <pre>
      verbose: Begin Parsing file '/home/nickanderson/CFEngine/masterfiles/./services/autorun/hello.cf'
      verbose: End Parsing file '/home/nickanderson/CFEngine/masterfiles/./services/autorun/hello.cf'
      verbose: Using bundlesequence => {'inventory_control','inventory_control','inventory_any','inventory_autorun','inventory_linux','inventory_lsb','inventory_debian','inventory_os','def','cfengine_enterprise_hub_ha','cfsketch_run','services_autorun','autorun','cfe_internal_management','main','cfengine_enterprise_hub_ha'}

      verbose: B: BEGIN bundle services_autorun
      verbose: A: Bundle Accounting Summary for 'services_autorun' in namespace default
      verbose: A: Zero promises executed for bundle 'services_autorun'
      verbose: B: END bundle services_autorun
      </pre>

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel