[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1608-gd4319a5

Markus Roberts Markus at reality.com
Thu Jan 21 14:18:58 UTC 2010


The following commit has been merged in the upstream branch:
commit 67216aa5637a0e134750103abb74b5c2e3db3eb6
Author: Markus Roberts <Markus at reality.com>
Date:   Fri Jan 15 14:31:22 2010 -0800

    Fix for #3075 (sshkey host_aliases ignored)
    
    In the alias --> host_aliases conversion, I overlooked parsed file
    provider for sshkeys.
    
    Now with tests.

diff --git a/lib/puppet/provider/sshkey/parsed.rb b/lib/puppet/provider/sshkey/parsed.rb
index 4673b57..e84e3e5 100755
--- a/lib/puppet/provider/sshkey/parsed.rb
+++ b/lib/puppet/provider/sshkey/parsed.rb
@@ -21,14 +21,14 @@ Puppet::Type.type(:sshkey).provide(:parsed,
         :post_parse => proc { |hash|
             names = hash[:name].split(",", -1)
             hash[:name]  = names.shift
-            hash[:alias] = names
+            hash[:host_aliases] = names
         },
         :pre_gen => proc { |hash|
-            if hash[:alias]
-                names = [hash[:name], hash[:alias]].flatten
+            if hash[:host_aliases]
+                names = [hash[:name], hash[:host_aliases]].flatten
 
-                hash[:name] = [hash[:name], hash[:alias]].flatten.join(",")
-                hash.delete(:alias)
+                hash[:name] = [hash[:name], hash[:host_aliases]].flatten.join(",")
+                hash.delete(:host_aliases)
             end
         }
 end
diff --git a/spec/unit/provider/sshkey/parsed.rb b/spec/unit/provider/sshkey/parsed.rb
index c97656f..fc6c85d 100755
--- a/spec/unit/provider/sshkey/parsed.rb
+++ b/spec/unit/provider/sshkey/parsed.rb
@@ -8,12 +8,31 @@ describe provider_class do
     before do
         @sshkey_class = Puppet::Type.type(:sshkey)
         @provider_class = @sshkey_class.provider(:parsed)
+        @key = 'AAAAB3NzaC1yc2EAAAABIwAAAQEAzwHhxXvIrtfIwrudFqc8yQcIfMudrgpnuh1F3AV6d2BrLgu/yQE7W5UyJMUjfj427sQudRwKW45O0Jsnr33F4mUw+GIMlAAmp9g24/OcrTiB8ZUKIjoPy/cO4coxGi8/NECtRzpD/ZUPFh6OEpyOwJPMb7/EC2Az6Otw4StHdXUYw22zHazBcPFnv6zCgPx1hA7QlQDWTu4YcL0WmTYQCtMUb3FUqrcFtzGDD0ytosgwSd+JyN5vj5UwIABjnNOHPZ62EY1OFixnfqX/+dUwrFSs5tPgBF/KkC6R7tmbUfnBON6RrGEmu+ajOTOLy23qUZB4CQ53V7nyAWhzqSK+hw=='
     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",""]
+    it "should parse the name from the first field" do 
+        @provider_class.parse_line('test ssh-rsa '+ at key)[:name].should == "test"
+    end
+
+    it "should parse the first component of the first field as the name" do 
+        @provider_class.parse_line('test,alias ssh-rsa '+ at key)[:name].should == "test"
+    end
+
+    it "should parse host_aliases from the remaining components of the first field" do 
+        @provider_class.parse_line('test,alias ssh-rsa '+ at key)[:host_aliases].should == ["alias"]
+    end
+
+    it "should parse multiple host_aliases" do 
+        @provider_class.parse_line('test,alias1,alias2,alias3 ssh-rsa '+ at key)[:host_aliases].should == ["alias1","alias2","alias3"]
+    end
+
+    it "should not drop an empty host_alias" do 
+        @provider_class.parse_line('test,alias, ssh-rsa '+ at key)[:host_aliases].should == ["alias",""]
+    end
+
+    it "should recognise when there are no host aliases" do 
+        @provider_class.parse_line('test ssh-rsa '+ at key)[:host_aliases].should == []
     end
 
 end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list