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

Regression: cannot set file owner to new user when purging unmanaged users

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.10.2, PUP 4.10.3, PUP 4.10.4
    • Fix Version/s: PUP 4.10.5, PUP 5.0.1
    • Component/s: None
    • Labels:
      None
    • Environment:

      Issue occurs on CentOS 7.3
      Issue does not occur on Ubuntu 16.04

    • Template:
    • Team:
      Agent
    • Story Points:
      2
    • Sprint:
      Agent 2017-07-26
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      On Centos 7, puppet could not create a user and set the owner of a file to that user in the same run. This was a regression introduced in 4.10.2 and 5.0.0.
    • QA Risk Assessment:
      Automate

      Description

      When using "resources

      { 'user': purge => true }

      ", a file owned by a puppet-managed user cannot be created when that user is being created in the same run.

      Simple test case:

      test.pp

      group { 'test':
        ensure => 'present',
        system => true,
      }
       
      user { 'test':
        ensure => 'present',
        system => true,
        groups => [],
      }
       
      file { '/tmp/test':
        ensure => 'file',
        owner  => 'test',
        group  => 'test',
        mode   => '0644',
      }
       
      resources { 'user':
        purge => true,
      }
      

      Under CentOS 7.3, this successfully creates the user and group, and creates the /tmp/test file with ownership root:root (should be test:test), and errors:

      [vagrant@hashiserver-1 vagrant]$ sudo puppet apply test.pp 
      Notice: Compiled catalog for hashiserver-1.node.vagrant.consul in environment production in 0.12 seconds
      Notice: /Stage[main]/Main/Group[test]/ensure: created
      Notice: /Stage[main]/Main/User[test]/ensure: created
      Error: Could not set 'file' on ensure: Could not find user test at /vagrant/test.pp:12
      Error: Could not set 'file' on ensure: Could not find user test at /vagrant/test.pp:12
      Wrapped exception:
      Could not find user test
      Error: /Stage[main]/Main/File[/tmp/test]/ensure: change from absent to file failed: Could not set 'file' on ensure: Could not find user test at /vagrant/test.pp:12
      Notice: Applied catalog in 0.29 seconds
      

      A subsequent "sudo puppet apply test.pp" completes successfully.

      This problem was introduced in puppet-agent 4.10.2.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              mmickan Mark Mickan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support