Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-6906

ensure => absent and recurse => true with a source results in error

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.2.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:

      Fedora Linux 24

    • Template:

      Description

      To reproduce:

      $ mkdir /tmp/a
      $ touch /tmp/a/b
      $ cat > test.pp << 'EOF'
      > file { '/tmp/c':
      >   ensure  => absent,
      >   source  => 'file:///tmp/a',
      >   recurse => true,
      > }
      > EOF
      $ puppet apply test.pp 
      Notice: Compiled catalog for […] in environment production in 0.26 seconds
      Error: Could not set 'file' on ensure: No such file or directory @ dir_s_rmdir - /tmp/c/b20161109-21872-r136ct.lock
      Error: Could not set 'file' on ensure: No such file or directory @ dir_s_rmdir - /tmp/c/b20161109-21872-r136ct.lock
      Wrapped exception:
      No such file or directory @ dir_s_rmdir - /tmp/c/b20161109-21872-r136ct.lock
      Error: /Stage[main]/Main/File[/tmp/c/b]/ensure: change from absent to file failed: Could not set 'file' on ensure: No such file or directory @ dir_s_rmdir - /tmp/c/b20161109-21872-r136ct.lock
      

      It seems that when recursing, the files do not inherit the `ensure` value, but are always set to `file`.

      In the actual source there has to be a `source` attribute, because the `ensure` is dynamic.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              loopsysdev Loop
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support