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

files_single_copy should not prevent copying for files that do not match a listed regular expression

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: 3.9.0, 3.7.4
    • Fix Version/s: None
    • Component/s: Promise type: files
    • Labels:
      None
    • Steps to reproduce:
      Acceptance/unit test attached

      Description

      While implementing https://tracker.mender.io/browse/CFE-2458 I found some issues with files_single_copy.

      My testing indicates that a setting for files_single_copy in body agent control that should not match the promised file does. Effectively this is equivalent to having files_single_copy set to .*.

      I found no existing mention of files_single_copy in the core acceptance tests so I wrote some. The tests in core pr 2658 test that files_single_copy works as expected in the case of an exact match (subsequent copies are skipped), files_single_copy does not apply to non matching expressions, and that files_single_copy applies when a regular expression is matched.

      Failing test summary:

      • agent_control_files_single_copy_does_not_apply_to_nonmatching_files_1.cf
      • agent_control_files_single_copy_does_not_apply_to_nonmatching_files_2.cf
      • agent_control_files_single_copy_does_not_apply_to_nonmatching_files_3.cf
      • agent_control_files_single_copy_does_not_apply_to_nonmatching_files_4.cf
      • agent_control_files_single_copy_does_not_apply_to_nonmatching_files.cf

      Some test output from 3.9.0:

      CFEngine Core 3.9.0
      CFEngine Enterprise 3.9.0
      cf-agent -KIf ./agent_control_files_single_copy_does_not_apply_to_nonmatching_files_1.cf --define AUTO
          info: Created directory '/tmp/TESTDIR.cfengine/.'
      R: test description: Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times.
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./../dcs.cf.sub SFAIL/CFE-2459
          info: Created file '/tmp/TESTDIR.cfengine/one', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/one'
          info: Created file '/tmp/TESTDIR.cfengine/two', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/two'
          info: Copying from 'localhost:/tmp/TESTDIR.cfengine/one'
          info: Skipping single-copied file '/tmp/TEST.cfengine'
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./agent_control_files_single_copy_does_not_apply_to_nonmatching_files_1.cf FAIL
      
      cf-agent -KIf ./agent_control_files_single_copy_does_not_apply_to_nonmatching_files_2.cf --define AUTO
          info: Created directory '/tmp/TESTDIR.cfengine/.'
      R: test description: Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times.
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./../dcs.cf.sub SFAIL/CFE-2459
          info: Created file '/tmp/TESTDIR.cfengine/one', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/one'
          info: Created file '/tmp/TESTDIR.cfengine/two', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/two'
          info: Copying from 'localhost:/tmp/TESTDIR.cfengine/one'
          info: Skipping single-copied file '/tmp/TEST.cfengine'
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./agent_control_files_single_copy_does_not_apply_to_nonmatching_files_2.cf FAIL
      
      cf-agent -KIf ./agent_control_files_single_copy_does_not_apply_to_nonmatching_files_3.cf --define AUTO
          info: Created directory '/tmp/TESTDIR.cfengine/.'
      R: test description: Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times.
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./../dcs.cf.sub SFAIL/CFE-2459
          info: Created file '/tmp/TESTDIR.cfengine/one', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/one'
          info: Created file '/tmp/TESTDIR.cfengine/two', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/two'
          info: Copying from 'localhost:/tmp/TESTDIR.cfengine/one'
          info: Skipping single-copied file '/tmp/TEST.cfengine'
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./agent_control_files_single_copy_does_not_apply_to_nonmatching_files_3.cf FAIL
      
      cf-agent -KIf ./agent_control_files_single_copy_does_not_apply_to_nonmatching_files_4.cf --define AUTO
          info: Created directory '/tmp/TESTDIR.cfengine/.'
      R: test description: Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times.
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./../dcs.cf.sub SFAIL/CFE-2459
          info: Created file '/tmp/TESTDIR.cfengine/one', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/one'
          info: Created file '/tmp/TESTDIR.cfengine/two', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/two'
          info: Copying from 'localhost:/tmp/TESTDIR.cfengine/one'
          info: Skipping single-copied file '/tmp/TEST.cfengine'
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./agent_control_files_single_copy_does_not_apply_to_nonmatching_files_4.cf FAIL
      
      cf-agent -KIf ./agent_control_files_single_copy_does_not_apply_to_nonmatching_files_5.cf --define AUTO
          info: Created directory '/tmp/TESTDIR.cfengine/.'
      R: test description: Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times.
          info: Created file '/tmp/TESTDIR.cfengine/one', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/one'
          info: Created file '/tmp/TESTDIR.cfengine/two', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/two'
          info: Copying from 'localhost:/tmp/TESTDIR.cfengine/one'
          info: Updated '/tmp/TEST.cfengine' from source '/tmp/TESTDIR.cfengine/two' on 'localhost'
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./agent_control_files_single_copy_does_not_apply_to_nonmatching_files_5.cf Pass
      
      cf-agent -KIf ./agent_control_files_single_copy_does_not_apply_to_nonmatching_files.cf --define AUTO
          info: Created directory '/tmp/TESTDIR.cfengine/.'
      R: test description: Test that files_single_copy does not prevent file patterns that do not match from being copied multiple times.
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./../dcs.cf.sub SFAIL/CFE-2459
          info: Created file '/tmp/TESTDIR.cfengine/one', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/one'
          info: Created file '/tmp/TESTDIR.cfengine/two', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/two'
          info: Copying from 'localhost:/tmp/TESTDIR.cfengine/one'
          info: Skipping single-copied file '/tmp/TEST.cfengine'
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./agent_control_files_single_copy_does_not_apply_to_nonmatching_files.cf FAIL
      
      cf-agent -KIf ./agent_control_files_single_copy_prevents_subsequent_copy_on_exact_match.cf --define AUTO
          info: Created directory '/tmp/TESTDIR.cfengine/.'
      R: test description: Test that files_single_copy prevents subsequnt copy of a file when there is an exact match.
          info: Created file '/tmp/TESTDIR.cfengine/one', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/one'
          info: Created file '/tmp/TESTDIR.cfengine/two', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/two'
          info: Copying from 'localhost:/tmp/TESTDIR.cfengine/one'
          info: Skipping single-copied file '/tmp/TEST.cfengine'
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./agent_control_files_single_copy_prevents_subsequent_copy_on_exact_match.cf Pass
      
      cf-agent -KIf ./agent_control_files_single_copy_prevents_subsequent_copy_on_regular_expression_match.cf --define AUTO
          info: Created directory '/tmp/TESTDIR.cfengine/.'
      R: test description: Test that files_single_copy prevents subsequnt copy of a file when there is a matching regular expression.
          info: Created file '/tmp/TESTDIR.cfengine/one', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/one'
          info: Created file '/tmp/TESTDIR.cfengine/two', mode 0600
          info: Edit file '/tmp/TESTDIR.cfengine/two'
          info: Copying from 'localhost:/tmp/TESTDIR.cfengine/one'
          info: Skipping single-copied file '/tmp/TEST.cfengine'
      R: /home/nickanderson/CFEngine/core/tests/acceptance/10_files/./agent_control_files_single_copy_prevents_subsequent_copy_on_regular_expression_match.cf Pass
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                a10003 Eystein Maloy Stenberg
                Reporter:
                a10042 Nick Anderson
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Summary Panel