summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2009-11-19 01:18:53 -0800
committerJames Turnbull <james@lovedthanlost.net>2009-11-21 13:38:22 +1100
commit9cfe390515b464acae8268c2688543a9d816734c (patch)
tree654e81703be5009f77d698b9faa49e68cce2a35c /lib/puppet
parent53b3b86681e3c56f8455e5d8458b4ea900a50406 (diff)
downloadpuppet-9cfe390515b464acae8268c2688543a9d816734c.tar.gz
puppet-9cfe390515b464acae8268c2688543a9d816734c.tar.xz
puppet-9cfe390515b464acae8268c2688543a9d816734c.zip
Fixing 2812 authorized_keys without comments fail
This is technically a duplicate of #1531, I think this change prevents the problem that appears in #2812, without touching the underlying issues of #1531. ssh_authorized_key was failing on keys in ~/.ssh/authorized_keys that lack a comment field - it would generate a Ssh_authorized_key resource with the name set to nil, which raises "ArgumentError: Field 'name' is required." Fixed by setting such keys' name fields to an empty string. This prevents the error from being raised and the authorized_keys files round-trip successfully. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/provider/ssh_authorized_key/parsed.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/puppet/provider/ssh_authorized_key/parsed.rb b/lib/puppet/provider/ssh_authorized_key/parsed.rb
index 69eec9fde..b435c513c 100644
--- a/lib/puppet/provider/ssh_authorized_key/parsed.rb
+++ b/lib/puppet/provider/ssh_authorized_key/parsed.rb
@@ -14,8 +14,9 @@ Puppet::Type.type(:ssh_authorized_key).provide(:parsed,
:fields => %w{options type key name},
:optional => %w{options},
:rts => /^\s+/,
- :match => /^(?:(.+) )?(ssh-dss|ssh-rsa) ([^ ]+)(?: (.+))?$/,
+ :match => /^(?:(.+) )?(ssh-dss|ssh-rsa) ([^ ]+) ?(.*)$/,
:post_parse => proc { |h|
+ h[:name] = "" if h[:name] == :absent
h[:options] ||= [:absent]
h[:options] = Puppet::Type::Ssh_authorized_key::ProviderParsed.parse_options(h[:options]) if h[:options].is_a? String
},