beaker-puppet_install_helper 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/beaker-puppet_install_helper.gemspec +1 -1
- data/lib/beaker/ca_cert_helper.rb +12 -2
- data/spec/unit/beaker/ca_cert_helper_spec.rb +19 -0
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: be59c64ddf1bbf2d6467a1dcf22efb203441323b
         | 
| 4 | 
            +
              data.tar.gz: e838e73da0145c0f8181572ca105114c1189acca
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 04bb1747fd6ca6591807da4b9fc0785d2a3a0a178b114034de7621a04053998e51699e55c20012d9871cb1c56c9e456e04fc35c7ee8a9285ec978a7c4d057d24
         | 
| 7 | 
            +
              data.tar.gz: 3b1c6beed2aa8f5fc2f0b2242d4e4a5cf5847d5e71e420c225c6f7c8b98b93c6ad46925baa2487865a1b63ff649d16af39858c76ff8c2f835435b0ec5318c0c6
         | 
| @@ -15,11 +15,13 @@ module Beaker::CaCertHelper | |
| 15 15 | 
             
              #
         | 
| 16 16 | 
             
              ##
         | 
| 17 17 | 
             
              def install_ca_certs_on(hosts)
         | 
| 18 | 
            -
                 | 
| 18 | 
            +
                [hosts].flatten.each do |host|
         | 
| 19 19 | 
             
                  get_cert_hash.each do |cert_name, ca|
         | 
| 20 20 | 
             
                    create_cert_on_host(host, cert_name, ca)
         | 
| 21 21 | 
             
                    if host['platform'] =~ /windows/i
         | 
| 22 22 | 
             
                      add_windows_cert host, cert_name
         | 
| 23 | 
            +
                    elsif host['platform'] =~ /solaris/i
         | 
| 24 | 
            +
                      add_solaris_cert host, cert_name
         | 
| 23 25 | 
             
                    end
         | 
| 24 26 | 
             
                  end
         | 
| 25 27 | 
             
                end
         | 
| @@ -40,6 +42,14 @@ module Beaker::CaCertHelper | |
| 40 42 | 
             
                on host, "cmd /c certutil -v -addstore Root `cygpath -w #{ca_filename}`"
         | 
| 41 43 | 
             
              end
         | 
| 42 44 |  | 
| 45 | 
            +
              ##
         | 
| 46 | 
            +
              # Install cert, assumes cygwin currently
         | 
| 47 | 
            +
              ##
         | 
| 48 | 
            +
              def add_solaris_cert(host, ca_filename)
         | 
| 49 | 
            +
                on host, "echo '# #{ca_filename}' >> /opt/puppet/ssl/cert.pem"
         | 
| 50 | 
            +
                on host, "cat #{ca_filename} >> /opt/puppet/ssl/cert.pem"
         | 
| 51 | 
            +
              end
         | 
| 52 | 
            +
             | 
| 43 53 | 
             
              ##
         | 
| 44 54 | 
             
              # Returns a hash of certificates where the Key is the pem cert name, and the value is the certificate
         | 
| 45 55 | 
             
              # @return Hash<String,String>
         | 
| @@ -126,4 +136,4 @@ A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y | |
| 126 136 |  | 
| 127 137 | 
             
            end
         | 
| 128 138 |  | 
| 129 | 
            -
            include Beaker::CaCertHelper
         | 
| 139 | 
            +
            include Beaker::CaCertHelper
         | 
| @@ -22,6 +22,16 @@ describe 'beaker::ca_cert_helper' do | |
| 22 22 | 
             
                  expect(subject).to receive(:create_cert_on_host).with(w2k3, 'usertrust-network.pem', 'my user trust cert')
         | 
| 23 23 | 
             
                  subject.install_ca_certs_on w2k3
         | 
| 24 24 | 
             
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                it "solaris 11 node" do
         | 
| 27 | 
            +
                  sol = {"platform" => 'solaris-11-x86_64', 'distmoduledir' => '/dne', 'hieraconf' => '/dne'}
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                  expect(subject).to receive(:add_solaris_cert).with(sol, 'geotrustglobal.pem')
         | 
| 30 | 
            +
                  expect(subject).to receive(:create_cert_on_host).with(sol, 'geotrustglobal.pem', 'my cert string')
         | 
| 31 | 
            +
                  expect(subject).to receive(:add_solaris_cert).with(sol, 'usertrust-network.pem')
         | 
| 32 | 
            +
                  expect(subject).to receive(:create_cert_on_host).with(sol, 'usertrust-network.pem', 'my user trust cert')
         | 
| 33 | 
            +
                  subject.install_ca_certs_on sol
         | 
| 34 | 
            +
                end
         | 
| 25 35 | 
             
              end
         | 
| 26 36 |  | 
| 27 37 | 
             
              describe 'add_windows_cert' do
         | 
| @@ -32,6 +42,15 @@ describe 'beaker::ca_cert_helper' do | |
| 32 42 | 
             
                }
         | 
| 33 43 | 
             
              end
         | 
| 34 44 |  | 
| 45 | 
            +
              describe 'add_solaris_cert' do
         | 
| 46 | 
            +
                it {
         | 
| 47 | 
            +
                  host = {"platform" => 'solaris-11-x86_64', 'distmoduledir' => '/dne', 'hieraconf' => '/dne'}
         | 
| 48 | 
            +
                  expect(subject).to receive(:on).with(host, 'echo \'# geotrustglobal.pem\' >> /opt/puppet/ssl/cert.pem')
         | 
| 49 | 
            +
                  expect(subject).to receive(:on).with(host, 'cat geotrustglobal.pem >> /opt/puppet/ssl/cert.pem')
         | 
| 50 | 
            +
                  subject.add_solaris_cert host, 'geotrustglobal.pem'
         | 
| 51 | 
            +
                }
         | 
| 52 | 
            +
              end
         | 
| 53 | 
            +
             | 
| 35 54 | 
             
              describe 'get_cert_hash' do
         | 
| 36 55 | 
             
                it 'should contain 3 certs' do
         | 
| 37 56 | 
             
                  cert_hash = subject.get_cert_hash
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: beaker-puppet_install_helper
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.4.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Puppetlabs
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015- | 
| 11 | 
            +
            date: 2015-11-18 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rspec
         | 
| @@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 77 77 | 
             
                  version: '0'
         | 
| 78 78 | 
             
            requirements: []
         | 
| 79 79 | 
             
            rubyforge_project: 
         | 
| 80 | 
            -
            rubygems_version: 2. | 
| 80 | 
            +
            rubygems_version: 2.2.3
         | 
| 81 81 | 
             
            signing_key: 
         | 
| 82 82 | 
             
            specification_version: 4
         | 
| 83 83 | 
             
            summary: Puppet install helper for Beaker
         |