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

CFEngine allows double `contain` body, but discards all but the last one

    XMLWordPrintable

    Details

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

      Description

      Hello,

      consider the following bundle::

      bundle agent test

      { commands: "/usr/bin/git clone https://github.com/cfengine/core.git" contain => in_dir("/tmp"), contain => silent; }

      CFEengine 3.7.1 happily accepts it, but ignores the `in_dir("/tmp")`
      part and only honors the second occurrence of `contain`::

      $ cf-agent -I -f ./TEST.cf
      info: Executing 'no timeout' ... '/usr/bin/git clone https://github.com/cfengine/core.git'
      info: Completed execution of '/usr/bin/git clone https://github.com/cfengine/core.git'

      $ ls /tmp/core
      ls: cannot access /tmp/core: No such file or directory

      $ ls ./core
      3rdparty BSDmakefile cf-key cf-runagent ChangeLog configure_flags.env.in docs GLOBALS libcfnet libpromises m4 README.md
      AUTHORS cf-agent cf-monitord cf-serverd checkglobals.sh contrib examples HACKING.md libcompat libutils Makefile.am splint-check.sh

      I think CFEngine should reject duplicate bodies of the same type as an
      error during parsing/policy verification. Or at least issue a
      warning.

      (The above test case comes from an actual policy file in which several
      rather long bodies were applied, making it quite difficult to spot the
      duplication.)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              riccardomurri Riccardo Murri
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Summary Panel