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

Canonify Regression

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.2
    • Component/s: Evaluation
    • Labels:
      None

      Description

      I have started to test version 3.6.0 and I am curious if this behavior would be considered a regression.

      It appears that in 3.6, when an variable is not initialized, an ifvarclass referencing that variable using the canonify class always returns true.

      For example, this agent:

      <pre>
      bundle agent init
      {
      vars:

      any::

      "sl[a]" string => "aa";
      "sl[b]" string => "bb";
      "sl[c]" string => "cc";

      test::

      "q" slist => getindices("sl");

      commands:

      test::

      "/bin/echo $(q)"
      classes => test("qwerty_$(q)");

      reports:

      cfengine::

      "$(q) – $(sl[$(q)])"
      ifvarclass => canonify("qwerty_$(q)");
      }

      body classes test
      {
      kept_returncodes =>

      { "0" }

      ;
      promise_kept =>

      { "$(x)" }

      ;
      }
      </pre>

      when run w/ 3.5 will not display anything if -D test is not defined

      <pre>
      steven@system1:~ $ /usr/local/sbin/cf-agent -V
      CFEngine Core 3.5.3

      steven@system1:~ $ /usr/local/sbin/cf-agent -KI -f ./sample.cf -b init -D test
      2014-06-30T17:22:18-0400 notice: R: a – aa
      2014-06-30T17:22:18-0400 notice: R: b – bb
      2014-06-30T17:22:18-0400 notice: R: c – cc

      steven@system1:~ $ /usr/local/sbin/cf-agent -KI -f ./sample.cf -b init
      2014-06-30T17:23:48-0400 info: Using command line specified bundlesequence
      </pre>

      However, on a 3.6 agent, it will:

      <pre>
      steven@system2:~ $ /usr/local/sbin/cf-agent -V
      CFEngine Core 3.6.0

      steven@system2:~ $ /usr/local/sbin/cf-agent -KI -f ./sample.cf -b init
      2014-06-30T17:19:33-0400 info: Using command line specified bundlesequence
      R: $(q) – $(sl[$(q)])

      steven@system2:~ $ /usr/local/sbin/cf-agent -KI -f ./sample.cf -b init -D test
      R: a – aa
      R: b – bb
      R: c – cc
      </pre>

        Attachments

          Activity

            People

            • Assignee:
              a10025 Volker Hilsheimer (Inactive)
              Reporter:
              skreuzer Steven Kreuzer
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel