forked from bruce/puppet-vcsrepo
    
        
        - 
                Notifications
    
You must be signed in to change notification settings  - Fork 286
 
Open
Labels
Description
Describe the Bug
For a vcsrepo resource that has the revision parameter and the owner and/or group parameters set, vcsrepo will change the ownership of an existing directory even when the --noop option is set.
Expected Behavior
A noop run should make no changes to the target system.
Steps to Reproduce
This is an example for the group parameter; the owner parameter behaves the same way.
- Create a 
test.ppfile with contents: 
vcsrepo { '/tmp/repo':
    ensure   => 'present',
    user     => 'root',
    group    => 'root',
    provider => 'git',
    source   => 'https://github.com/puppetlabs/puppetlabs-vcsrepo.git',
    revision => 'main',
}
- Apply the file; example output:
 
$ sudo puppet apply test.pp
Notice: Compiled catalog for <redacted> in environment production in 0.11 seconds
Notice: /Stage[main]/Main/Vcsrepo[/tmp/repo]/ensure: created
Notice: Applied catalog in 0.83 seconds
- Check ownership of the new repo directory. Change ownership and check again to ensure the change was made; example output:
 
$ ls -ld /tmp/repo
drwxr-xr-x 10 root root 4096 Dec  8 22:58 /tmp/repo
$ sudo chown -R :nobody /tmp/repo
$ ls -ld /tmp/repo
drwxr-xr-x 10 root nobody 4096 Dec  8 22:58 /tmp/repo
- Do a noop run. Example output:
 
$ sudo puppet apply test.pp --noop
Notice: Compiled catalog for <redacted> in environment production in 0.10 seconds
Notice: Applied catalog in 0.72 seconds
- Check the ownership again, which should be unchanged (still 
nobodyas the group). 
$ ls -ld /tmp/repo
drwxr-xr-x 10 root root 4096 Dec  8 22:58 /tmp/repo
Environment
- Vcsrepo current 
main:3d78c5b129e4758a12df7e36a009bdc305509dbd - AlmaLinux 8.7
 - Puppet 7.14.0
 
Additional Context
- Removing the 
revisionparameter makes this problem go away. - The ownership change is recursive--not just to the top-level directory.
 
Thanks,
Corey