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

Mounts with symlinks get continually remounted

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: PUP 4.10.0, PUP 5.5.1
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Environment:
    • Template:
      PUP Bug Template
    • Acceptance Criteria:
      Hide

      The repro code only creates two mount points regardless of how many times it's run.

      Show
      The repro code only creates two mount points regardless of how many times it's run.
    • Team:
      Platform OS
    • Method Found:
      Needs Assessment
    • QA Risk Assessment:
      Needs Assessment

      Description

      Puppet Version: 5.5.1
      Puppet Server Version: N/A
      OS Name/Version: Linux

      Possibly related to this `mount` tmpfs bug that was never reproduced.

      Using the `mount` type/provider on linux systems – possibly BSD/Unix-like systems as well, not tested – if a mount is created at a path that contains a symlink, the mount will be created newly each puppet run.

      Repro steps:

      Using mounttmp.pp:

      $ docker pull puppet/puppet-agent
      $ cat >mounttmp.pp <<-EOF
      \$dir = '/var/run/test'
      \$dir2 = '/run/test2'
      exec { 'dir':
          command => "/bin/mkdir -p \${dir} \${dir2}",
      }
      mount { [\$dir, \$dir2]:
          ensure => mounted,
          fstype => tmpfs,
          device => tmpfs,
          options => 'size=1m',
          remounts => false,
          require => Exec['dir'],
      }
      EOF
      $ check="mount | grep /test" && puppet='puppet apply --verbose -e "$(cat /workspace/code.pp)"'
      $ docker run --hostname test.example.com --cap-add=SYS_ADMIN -it --rm --entrypoint 'sh' -v $PWD/mounttmp.pp:/workspace/code.pp puppet/puppet-agent -c "$check ; $puppet ; $check ; $puppet ; $check"
      

      Desired Behavior:

      `Mount[/var/run/test]` should not create duplicate mounts every puppet run.

      Actual Behavior:

      $ docker run -it --rm puppet/puppet-agent --version
      5.5.1
      $ cat mounttmp.pp
      $dir = '/var/run/test'
      $dir2 = '/run/test2'
      exec { 'dir':
          command => "/bin/mkdir -p ${dir} ${dir2}",
      }
      mount { [$dir, $dir2]:
          ensure => mounted,
          fstype => tmpfs,
          device => tmpfs,
          options => 'size=1m',
          remounts => false,
          require => Exec['dir'],
      }
      $ check="mount | grep /test" && puppet='puppet apply --test --trace -e "$(cat /workspace/code.pp)"'
      $ docker run --hostname test.example.com --cap-add=SYS_ADMIN -it --rm --entrypoint 'sh' -v $PWD/mounttmp.pp:/workspace/code.pp puppet/puppet-agent -c "$check ; $puppet ; $check ; $puppet ; $check"
      Notice: Compiled catalog for test.example.com in environment production in 0.07 seconds
      Info: Applying configuration version '1537822009'
      Notice: /Stage[main]/Main/Exec[dir]/returns: executed successfully
      Notice: /Stage[main]/Main/Mount[/var/run/test]/ensure: defined 'ensure' as 'mounted'
      Info: Computing checksum on file /etc/fstab
      Info: /Stage[main]/Main/Mount[/var/run/test]: Scheduling refresh of Mount[/var/run/test]
      Info: Mount[/var/run/test](provider=parsed): Remounting
      Notice: /Stage[main]/Main/Mount[/var/run/test]: Triggered 'refresh' from 1 event
      Info: /Stage[main]/Main/Mount[/var/run/test]: Scheduling refresh of Mount[/var/run/test]
      Notice: /Stage[main]/Main/Mount[/run/test2]/ensure: defined 'ensure' as 'mounted'
      Info: /Stage[main]/Main/Mount[/run/test2]: Scheduling refresh of Mount[/run/test2]
      Info: Mount[/run/test2](provider=parsed): Remounting
      Notice: /Stage[main]/Main/Mount[/run/test2]: Triggered 'refresh' from 1 event
      Info: /Stage[main]/Main/Mount[/run/test2]: Scheduling refresh of Mount[/run/test2]
      Info: Creating state file /opt/puppetlabs/puppet/cache/state/state.yaml
      Notice: Applied catalog in 0.16 seconds
      tmpfs on /run/test type tmpfs (rw,relatime,size=1024k)
      tmpfs on /run/test2 type tmpfs (rw,relatime,size=1024k)
      Notice: Compiled catalog for test.example.com in environment production in 0.07 seconds
      Info: Applying configuration version '1537822012'
      Notice: /Stage[main]/Main/Exec[dir]/returns: executed successfully
      Notice: /Stage[main]/Main/Mount[/var/run/test]/ensure: ensure changed 'unmounted' to 'mounted'
      Info: /Stage[main]/Main/Mount[/var/run/test]: Scheduling refresh of Mount[/var/run/test]
      Info: Mount[/var/run/test](provider=parsed): Remounting
      Notice: /Stage[main]/Main/Mount[/var/run/test]: Triggered 'refresh' from 1 event
      Info: /Stage[main]/Main/Mount[/var/run/test]: Scheduling refresh of Mount[/var/run/test]
      Notice: Applied catalog in 0.11 seconds
      tmpfs on /run/test type tmpfs (rw,relatime,size=1024k)
      tmpfs on /run/test2 type tmpfs (rw,relatime,size=1024k)
      tmpfs on /run/test type tmpfs (rw,relatime,size=1024k)
      

       Notice the `tmpfs on /run/test...` lines show `/run/test` and `/run/test2` as being present once in the mounttab after the first run, but `/run/test` appears twice after the second run. The only difference is that `/run/test` is being created by `Mount[/var/run/test]` vs `Mount[/run/test2]` (`/var/run` is a symlink to `/run`).

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cloakedcode Alan Smith
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Zendesk Support