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

Update policy does not move obstructions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: To Do
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: 3.14.0
    • Fix Version/s: None
    • Component/s: Promise type: files
    • Labels:
      None
    • Found in version (details):
      3.10.3

      Description

      TL;DR: if CFEngine promises to create a file /someplace/somefile, but /someplace exists and is file (not a directory), CFEngine fails. Instead, it should remove the file and create directory in its place.

      Steps to reproduce:

      1. execute the following on the hub:

      sudo mkdir /var/cfengine/masterfiles/testme
      sudo touch /var/cfengine/masterfiles/testme/fine.cf
      sudo /var/cfengine/bin/cf-agent -Kf update.cf
      sudo /var/cfengine/bin/cf-agent -K
      

      2. execute the followith on bootstrapped host (before it updates the policy):

      sudo touch /var/cfengine/inputs/testme
      sudo /var/cfengine/bin/cf-agent -Kf update.cf
      

      You're greeted with an error:

         error: Unable to make directory for '/var/cfengine/inputs/testme/dummy' in file-copy 'masterfiles' to '(null)'
         error: Method 'cfe_internal_update_policy_cpv' failed in some repairs
      

      And the file is still a file:

      $ sudo ls -lad /var/cfengine/inputs/testme
      -rw-r--r--. 1 root root 0 2019-01-23 13:28 /var/cfengine/inputs/testme
      

      CFEngine should remove the offending file, instead of erroring out.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:

                Summary Panel