Issue #16167 has been updated by eric sorenson.

Status changed from Unreviewed to Closed
Assignee set to eric sorenson

I suspect this happens because the `owner` property is unmanaged in your 
`puppet apply` snippet, but once state.yaml is written out, it includes an 
`owner` property, so the subsequent run issues the warning from 
`lib/puppet/type/file/owner.rb:27. But I can't reproduce this on 2.7.x or 3.x. 
Consider upgrading?

<pre>
[[email protected] ~/Sandbox/puppet/lib/puppet/type/file]% puppet apply -e 
'file {"/tmp/foo": ensure => present, source => "/tmp/source" }'
notice: /Stage[main]//File[/tmp/foo]/ensure: defined content as 
'{md5}764efa883dda1e11db47671c4a3bbd9e'
notice: Finished catalog run in 0.02 seconds
[[email protected] ~/Sandbox/puppet/lib/puppet/type/file]% puppet apply -e 
'file {"/tmp/foo": ensure => present, source => "/tmp/source" }'
notice: Finished catalog run in 0.02 seconds
</pre>
----------------------------------------
Bug #16167: "warning: Cannot manage ownership unless running as root" - but 
only on 2nd and later invocations...
https://projects.puppetlabs.com/issues/16167#change-70230

Author: Peter Valdemar Mørch
Status: Closed
Priority: Normal
Assignee: eric sorenson
Category: 
Target version: 
Affected Puppet version: 2.6.2
Keywords: 
Branch: 


I am in fact intentionally running as non-root. All files of interest are owned 
by the same user.
If I use puppet to copy a source -> destination, it works fine the first time. 
Delete the destination and try again => get a warning. Delete the destination 
*and ~/.puppet* and try again => all is fine again.

Reproduction recipe:

    $ rm -rf /tmp/source /tmp/destination ~/.puppet/
    $ touch /tmp/source
    
    # First time no warning
    $ puppet -e 'file { "/tmp/destination": ensure => present, source => 
"/tmp/source" }'
    notice: /Stage[main]//File[/tmp/destination]/ensure: defined content as 
'{md5}d41d8cd98f00b204e9800998ecf8427e'

    $ rm /tmp/destination
    
    # Why do I get a warning here
    $ puppet -e 'file { "/tmp/destination": ensure => present, source => 
"/tmp/source" }'
    warning: Cannot manage ownership unless running as root
    notice: /Stage[main]//File[/tmp/destination]/ensure: defined content as 
'{md5}d41d8cd98f00b204e9800998ecf8427e'

    # Actually only necessary to delete ~/.puppet/var/state/state.yaml
    $ rm -rf /tmp/destination ~/.puppet/
    
    # But not here
    $ puppet -e 'file { "/tmp/destination": ensure => present, source => 
"/tmp/source" }'
    notice: /Stage[main]//File[/tmp/destination]/ensure: defined content as 
'{md5}d41d8cd98f00b204e9800998ecf8427e'

Version information: Debian Squeeze

    $ puppet --version
    2.6.2
    $ dpkg-query -W | grep puppet
    puppet      2.6.2-5+squeeze6
    puppet-common       2.6.2-5+squeeze6
    
I haven't actually tried it on newer versions of puppet (if I do then I'll 
update the bug), but regardless - it seems to be valid for 2.6.2 at least.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to