It looks like I was to restrictive here, see comments below On Sat, Apr 23, 2011 at 11:16:34AM +0200, Stefan Schulte wrote: > Whitespaces in any of the properties can lead to incorrect entries in > the authorized_keys file. > > Signed-off-by: Stefan Schulte <[email protected]> > --- > lib/puppet/type/ssh_authorized_key.rb | 12 ++++++++++++ > 1 files changed, 12 insertions(+), 0 deletions(-) > > diff --git a/lib/puppet/type/ssh_authorized_key.rb > b/lib/puppet/type/ssh_authorized_key.rb > index 8338e2d..170dc83 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
It is possible to create a key that has spaces in the comment field:
# ssh-keygen -t rsa -C 'My Test' -f test
So I guess we should also allow that?
>
> 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
After reading http://projects.puppetlabs.com/issues/1737 it looks like
even a single option can contain a comma. So when someone provides the
single option
from="host1,host2"
we shouldn't raise the error.
I updated the ticket http://projects.puppetlabs.com/issues/7114 and I'll
try to provide a fixup
-Stefan
pgpZXc7m5RTGi.pgp
Description: PGP signature
