diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2009-11-30 15:51:05 -0800 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-12-09 10:55:04 +1100 |
commit | 8b669985427a0acc41b842ce89047592922fa760 (patch) | |
tree | 950c96090ec88471b203fa56c40fce2ffac2181d /spec | |
parent | 7136c85877982804dbf99d239c4c74e59366d2a2 (diff) | |
download | puppet-8b669985427a0acc41b842ce89047592922fa760.tar.gz puppet-8b669985427a0acc41b842ce89047592922fa760.tar.xz puppet-8b669985427a0acc41b842ce89047592922fa760.zip |
Fixing 2849 puppet changes sshkey alias every run if it is blank
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@gmail.com>
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/provider/sshkey/parsed.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/unit/provider/sshkey/parsed.rb b/spec/unit/provider/sshkey/parsed.rb new file mode 100755 index 000000000..c97656fbd --- /dev/null +++ b/spec/unit/provider/sshkey/parsed.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' + +provider_class = Puppet::Type.type(:sshkey).provider(:parsed) + +describe provider_class do + before do + @sshkey_class = Puppet::Type.type(:sshkey) + @provider_class = @sshkey_class.provider(:parsed) + end + + it "should not drop an empty alias" do + line = 'test,alias, ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzwHhxXvIrtfIwrudFqc8yQcIfMudrgpnuh1F3AV6d2BrLgu/yQE7W5UyJMUjfj427sQudRwKW45O0Jsnr33F4mUw+GIMlAAmp9g24/OcrTiB8ZUKIjoPy/cO4coxGi8/NECtRzpD/ZUPFh6OEpyOwJPMb7/EC2Az6Otw4StHdXUYw22zHazBcPFnv6zCgPx1hA7QlQDWTu4YcL0WmTYQCtMUb3FUqrcFtzGDD0ytosgwSd+JyN5vj5UwIABjnNOHPZ62EY1OFixnfqX/+dUwrFSs5tPgBF/KkC6R7tmbUfnBON6RrGEmu+ajOTOLy23qUZB4CQ53V7nyAWhzqSK+hw==' + parsed = @provider_class.parse_line(line) + parsed[:alias].should == ["alias",""] + end + +end |