summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-05-16 16:34:39 -0700
committerNick Lewis <nick@puppetlabs.com>2011-05-16 16:34:39 -0700
commit99d437d2bbc2339f092304715ec562fbbcb0a50c (patch)
treed820b3e468d15038f6f16cee8115422387bbd1e7 /lib
parent83fa8cf03133174d7182adee6f34efc6ba15d6b3 (diff)
parentd22b1303de9a0dbc2c5b887eab0c9e146fcf13c6 (diff)
downloadpuppet-99d437d2bbc2339f092304715ec562fbbcb0a50c.tar.gz
puppet-99d437d2bbc2339f092304715ec562fbbcb0a50c.tar.xz
puppet-99d437d2bbc2339f092304715ec562fbbcb0a50c.zip
Merge branch 'ticket/2.7.next/7114' into 2.7.next
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/provider/ssh_authorized_key/parsed.rb6
-rw-r--r--lib/puppet/type/ssh_authorized_key.rb12
2 files changed, 12 insertions, 6 deletions
diff --git a/lib/puppet/provider/ssh_authorized_key/parsed.rb b/lib/puppet/provider/ssh_authorized_key/parsed.rb
index 6a3855c0e..81b1fbcfa 100644
--- a/lib/puppet/provider/ssh_authorized_key/parsed.rb
+++ b/lib/puppet/provider/ssh_authorized_key/parsed.rb
@@ -42,12 +42,6 @@ require 'puppet/provider/parsedfile'
0600
end
- def target
- @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
-
def user
uid = File.stat(target).uid
Etc.getpwuid(uid).name
diff --git a/lib/puppet/type/ssh_authorized_key.rb b/lib/puppet/type/ssh_authorized_key.rb
index 8338e2d64..170dc8383 100644
--- a/lib/puppet/type/ssh_authorized_key.rb
+++ b/lib/puppet/type/ssh_authorized_key.rb
@@ -14,6 +14,10 @@ module Puppet
system-wide primary key and therefore has to be unique."
isnamevar
+
+ validate do |value|
+ raise Puppet::Error, "Resourcename must not contain whitespace: #{value}" if value =~ /\s/
+ end
end
newproperty(:type) do
@@ -28,6 +32,10 @@ module Puppet
newproperty(:key) do
desc "The key itself; generally a long string of hex digits."
+
+ validate do |value|
+ raise Puppet::Error, "Key must not contain whitespace: #{value}" if value =~ /\s/
+ end
end
newproperty(:user) do
@@ -82,6 +90,10 @@ module Puppet
value.join(",")
end
end
+
+ validate do |value|
+ raise Puppet::Error, "Options must be provided as an array, not a comma separated list" if value != :absent and value.include?(',')
+ end
end
autorequire(:user) do