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

Files promise prematurely errors about being unable to chdir into a directory

    XMLWordPrintable

    Details

      Description

      When I promise that a file should exist in a directory that does not yet exist an error (Failed to chdir into '<DIRECTORY>'. (chdir: 'No such file or directory') ) is emitted, yet the directory does actually get created. I think this error message should not be emitted unless the files promise is truly unable to create the directory.

      Example Policy
      bundle agent test
      {
        files:
          "/tmp/test_dir/deep/test_file.txt" content => "hello";
      }    
      bundle agent cleanup
      {
        files:
          "/tmp/test_dir/deep/test_file.txt" delete => tidy;
          "/tmp/test_dir/deep/." delete => tidy;
          "/tmp/test_dir/." delete => tidy;
      }    
      bundle agent __main__
      {
        methods:
          "test";
          "cleanup";
        reports:
          "CFEngine version $(sys.cf_version)";
      }
      

      Example output:

         error: Failed to chdir into '/tmp/test_dir/deep'. (chdir: 'No such file or directory')
          info: Created directory for '/tmp/test_dir/deep/test_file.txt'
          info: Created file '/tmp/test_dir/deep/test_file.txt', mode 0600
          info: Updated file '/tmp/test_dir/deep/test_file.txt' with content 'hello'
          info: Deleted file '/tmp/test_dir/deep/test_file.txt'
          info: Deleted directory '/tmp/test_dir/deep'
          info: Deleted directory '/tmp/test_dir'
      R: CFEngine version 3.20.0a.311f7b0b7

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            a10042 Nick Anderson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: