Issue #2689 has been updated by Steve Wilson.

Affected version changed from 0.25.1rc1 to 0.25.1rc2

Definitely ran into this ownership bug with 0.25.1rc2 when running puppetmaster 
as non-root. The warnings show up anytime puppet tries to create or modify a 
file.  I really noticed it when rrdgraph reporting was enabled on the 
puppetmaster.  The puppetmaster log noise is deafening making it difficult to 
see what puppet is actually doing.
  
I applied the patch in this ticket, but it still warned.  I then also commented 
out "Cannot manage ownership unless running as root" warning message and all is 
well.  It would seem to be an unnecessary warning since in my testing when the 
file really couldn't be modified, an error was raised there.

----------------------------------------
Bug #2689: Running puppet as non-root => getting rid of all those ownership 
warnings
http://projects.reductivelabs.com/issues/2689

Author: Brian Ferris
Status: Accepted
Priority: Normal
Assigned to: Markus Roberts
Category: file
Target version: 
Affected version: 0.25.1rc2
Keywords: 
Branch: 


I'm using puppet to manage configs on machines where I don't have root access.  
Whenever I use a File resource where the source is a puppet:// resource, I get 
tons of warnings when I run puppet that look like:

@Cannot manage ownership unless running as root@

True enough, I'm not running as root.  However, these warnings seem to appear 
whether I omit the owner parameter or if I include the owner parameter (set to 
my current user account).  I'm using something like:

file { "${my_target_directory}":
  ensure => directory,
  recurse => true,
  source => "puppet://$puppet_server/path/to/source/dir"
}

Adding "owner => myUserId" doesn't help.  Also, I've confirmed that file owner 
on the puppetmaster server already matches my user account. These warnings tend 
to pile up and make it difficult to see more informative messages from puppet 
about what has actually changed when
updating.

As a solution, I propose modifying the logic in 
@lib/puppet/type/file/owner.rb@, specifically the @insync@ message.  I propose 
moving the check for root access AFTER the check for ownership has concluded 
that something needs to be changed.  This has the effect of only warning you 
about root access if an ownership change actually needs to be made.  See the 
following code for an example, and also the supplied patch.

<pre>
def insync?(current)

    if @should == nil
        return true
    end
        #
    @should.each do |value|
        if value =~ /^\d+$/
            uid = Integer(value)
        elsif value.is_a?(String)
            fail "Could not find user %s" % value unless uid = uid(value)
        else
            uid = value
        end

        return true if uid == current
    end

    unless Puppet::Util::SUIDManager.uid == 0
        warning "Cannot manage ownership unless running as root"
        return true
    end

    return false
end
</pre>

Note that I had to add a nil check as well, since I found some cases where the 
@owner@ property was applied even when I didn't specifically mention @owner@ in 
my recipe.


-- 
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://reductivelabs.com/redmine/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