diff options
author | Markus Roberts <Markus@reality.com> | 2009-10-20 19:52:50 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-10-21 20:22:47 +1100 |
commit | b4bcfe9106c43855fbb4d1d147945ddb0e08ab34 (patch) | |
tree | d8bd98bb1cd2154488d76a4f2c0847fa1d830224 /lib/puppet | |
parent | ae528f62e898fac37ea7d37c6fcff2e5c0954782 (diff) | |
download | puppet-b4bcfe9106c43855fbb4d1d147945ddb0e08ab34.tar.gz puppet-b4bcfe9106c43855fbb4d1d147945ddb0e08ab34.tar.xz puppet-b4bcfe9106c43855fbb4d1d147945ddb0e08ab34.zip |
Fix for #2736, target doesn't work for ssh_authorized_keys
There were a number of problems here (duplicated code, meaningless
tests, etc.) but the core was that the last definition of target
ignored the provided value if there was also a user specified.
Signed-off-by: Markus Roberts <Markus@reality.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/provider/ssh_authorized_key/parsed.rb | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/lib/puppet/provider/ssh_authorized_key/parsed.rb b/lib/puppet/provider/ssh_authorized_key/parsed.rb index 6df7f8ae0..28a68b364 100644 --- a/lib/puppet/provider/ssh_authorized_key/parsed.rb +++ b/lib/puppet/provider/ssh_authorized_key/parsed.rb @@ -36,14 +36,6 @@ Puppet::Type.type(:ssh_authorized_key).provide(:parsed, :rts => /^\s+/, :match => /^(?:(.+) )?(\d+) (\d+) (\d+)(?: (.+))?$/ - def target - @resource.should(:target) - end - - def user - @resource.should(:user) - end - def dir_perm # Determine correct permission for created directory and file # we can afford more restrictive permissions when the user is known @@ -67,39 +59,13 @@ Puppet::Type.type(:ssh_authorized_key).provide(:parsed, end def target - if user - File.expand_path("~%s/.ssh/authorized_keys" % user) - elsif target = @resource.should(:target) - target - end + @resource.should(:target) || File.expand_path("~%s/.ssh/authorized_keys" % user) end def user @resource.should(:user) end - 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 - end - - def file_perm - if target - if user - 0600 - else - 0644 - end - end - end - def flush # As path expansion had to be moved in the provider, we cannot generate new file # resources and thus have to chown and chmod here. It smells hackish. |