1 Dec 2009 01:05
[PATCH/puppet 1/1] Fixing 2849 puppet changes sshkey alias every run if it is blank
Jesse Wolfe <jes5199 <at> gmail.com>
2009-12-01 00:05:23 GMT
2009-12-01 00:05:23 GMT
Puppet was mis-parsing sshkey aliases when the last alias is an empty
string.
This is due to the counter-intuitive behavior of Ruby's String#split.
Signed-off-by: Jesse Wolfe <jes5199 <at> gmail.com>
---
lib/puppet/provider/sshkey/parsed.rb | 8 +++-----
spec/unit/provider/sshkey/parsed.rb | 19 +++++++++++++++++++
2 files changed, 22 insertions(+), 5 deletions(-)
create mode 100755 spec/unit/provider/sshkey/parsed.rb
diff --git a/lib/puppet/provider/sshkey/parsed.rb b/lib/puppet/provider/sshkey/parsed.rb
index 0dc791b..4673b57 100755
--- a/lib/puppet/provider/sshkey/parsed.rb
+++ b/lib/puppet/provider/sshkey/parsed.rb
<at> <at> -19,11 +19,9 <at> <at> Puppet::Type.type(:sshkey).provide(:parsed,
record_line :parsed, :fields => %w{name type key},
:post_parse => proc { |hash|
- if hash[:name] =~ /,/
- names = hash[:name].split(",")
- hash[:name] = names.shift
- hash[:alias] = names
- end
+ names = hash[:name].split(",", -1)
+ hash[:name] = names.shift
+ hash[:alias] = names
},
:pre_gen => proc { |hash|
if hash[:alias]
(Continue reading)
RSS Feed