[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
test branch
puppet-dev at googlegroups.com
Wed Jul 14 10:34:51 UTC 2010
The following commit has been merged in the upstream branch:
commit 0a21e1b7510d32e391e6263814bad5cc70c5d6dd
Author: Matt Robinson <matt at puppetlabs.com>
Date: Tue May 25 17:50:40 2010 -0700
[#2522] authorized keys owner is verified
The user method on the provider always returned what the resource should
be, not what it actually was, so it always seemed to be insync to
puppet.
Also cleaned up some cruft on the perms that did different things
depending on whether a user was specified on the resource. This isn't
necessary since a user is required on the resource.
Paired with: Jesse Wolfe
Signed-off-by: Matt Robinson <matt at puppetlabs.com>
diff --git a/lib/puppet/provider/ssh_authorized_key/parsed.rb b/lib/puppet/provider/ssh_authorized_key/parsed.rb
index b222e51..cc4e279 100644
--- a/lib/puppet/provider/ssh_authorized_key/parsed.rb
+++ b/lib/puppet/provider/ssh_authorized_key/parsed.rb
@@ -32,48 +32,35 @@ Puppet::Type.type(:ssh_authorized_key).provide(:parsed,
:match => /^(?:(.+) )?(\d+) (\d+) (\d+)(?: (.+))?$/
def dir_perm
- # Determine correct permission for created directory and file
- # we can afford more restrictive permissions when the user is known
- if target
- if user
- 0700
- else
- 0755
- end
- end
+ 0700
end
def file_perm
- if target
- if user
- 0600
- else
- 0644
- end
- end
+ 0600
end
def target
begin
- @resource.should(:target) || File.expand_path("~%s/.ssh/authorized_keys" % user)
+ @resource.should(:target) || File.expand_path("~#{@resource.should(:user)}/.ssh/authorized_keys")
rescue
raise Puppet::Error, "Target not defined and/or specified user does not exist yet"
end
end
def user
- @resource.should(:user)
+ uid = File.stat(target).uid
+ Etc.getpwuid(uid).name
end
def flush
- raise Puppet::Error, "Cannot write SSH authorized keys without user" unless user
- raise Puppet::Error, "User '#{user}' does not exist" unless uid = Puppet::Util.uid(user)
+ raise Puppet::Error, "Cannot write SSH authorized keys without user" unless @resource.should(:user)
+ raise Puppet::Error, "User '#{@resource.should(:user)}' does not exist" unless uid = Puppet::Util.uid(@resource.should(:user))
unless File.exist?(dir = File.dirname(target))
Puppet.debug "Creating #{dir}"
Dir.mkdir(dir, dir_perm)
File.chown(uid, nil, dir)
end
- Puppet::Util::SUIDManager.asuser(user) { super }
+ Puppet::Util::SUIDManager.asuser(@resource.should(:user)) { super }
File.chown(uid, nil, target)
File.chmod(file_perm, target)
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list