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

improve logging of constraint expansion

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: (None)
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Logging
    • Labels:
      None

      Description

      When I write this policy

      body file_select not_packages_modules
      {
        path_name => { "$(sys.inputdir)$(const.dirsep)modules/(?!packages).*" };
      }
      

      With --debug logging I get

       debug: DeRefCopyPromise():     copying body file_select: 'not_packages_modules'
         debug: DeRefCopyPromise():         expanding constraint 'path_name': ' {"$(sys.inputdir)/modules/(?!packages).*"}' -> ' {"$(sys.inputdir)/modules/(?!packages).*"}'
      

      Which indicates to me that the special variables are NOT being expanded at all and are the cause of trouble with my policy not working as expected.

      But with --log-modules=all I get the important and interesting information

         debug: ExpandScalar( (null) : this . not_packages_modules )  =>  not_packages_modules
         debug: ExpandScalar( (null) : this . true )  =>  true
         debug: VariableTableGet(default:sys.inputdir): string  => /var/cfengine/inputs
         debug: VariableTableGet(default:const.dirsep): string  => /
         debug: ExpandScalar( (null) : this . $(sys.inputdir)$(const.dirsep)modules/(?!packages).* )  =>  /var/cfengine/inputs/modules/(?!packages).*
      

      which clearly shows that the variables ARE expanded and have the expected values.

      We should move this last "ExpandScalar" message to debug level. Not sure how possible it is to know at the time of that log message that it is the "last expansion" but that would be the best in my mind and certainly better than having the other message which makes me think that the variables are not expanded at all. If nothing else, that other message should be removed.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              craig.comstock Craig Comstock
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Summary Panel