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

cf-agent should not emit an error about inability to change into subdirectory when it creates the subdir to satisfy a promise about a link

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Promise type: files
    • Labels:
      None

      Description

      When promising that a file in a sub directory that does not exist is a symlink to another file the agent emits an error indicating it was unable to change into the directory. However the agent does go ahead and create the subdirectory in order to satisfy the promise for the link.

      I believe that the agent should not emit an error for an issue that it automatically resolves.

      Steps to reprouce:

      find /tmp | grep subdir
      rm -rf /tmp/subdir/
      

      Policy:

      bundle agent main
      {
        files:
          "/tmp/subdir/doesnt/exist"
            link_from => ln_s("/tmp");
      }
      

      The above policy produces this output:

      error: Failed to chdir into '/tmp/subdir/doesnt'. (chdir: 'No such file or directory')
      

      Review state after policy run:

      find /tmp | grep subdir
      stat /tmp/subdir/doesnt/exist
      rm -rf /tmp/subdir/
      

      Commands produce this output: Note that the promised file is indeed a symlink to /tmp as promised.

      /tmp/subdir
      /tmp/subdir/doesnt
      /tmp/subdir/doesnt/exist
        File: /tmp/subdir/doesnt/exist -> /tmp
        Size: 4         	Blocks: 0          IO Block: 4096   symbolic link
      Device: fd01h/64769d	Inode: 13238454    Links: 1
      Access: (0777/lrwxrwxrwx)  Uid: ( 1000/nickanderson)   Gid: ( 1000/nickanderson)
      Access: 2017-09-11 12:44:50.677903994 -0500
      Modify: 2017-09-11 12:44:50.677903994 -0500
      Change: 2017-09-11 12:44:50.677903994 -0500
       Birth: -
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:

                Summary Panel