Skip to content

Commit

Permalink
Merge pull request #43 from joshcooper/windows-puppet-agent-msi
Browse files Browse the repository at this point in the history
Use puppet-agent specific helper when installing the MSI
  • Loading branch information
melissa authored Apr 26, 2018
2 parents dd6076f + 41f12a0 commit 92598e7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
6 changes: 5 additions & 1 deletion lib/beaker-puppet/install_utils/puppet5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ def install_artifact_on(host, artifact_url, project_name)
onhost_package_file = "#{project_name}*"
host.install_local_package(onhost_package_file)
when 'windows'
generic_install_msi_on(host, artifact_url)
if project_name == 'puppet-agent'
install_msi_on(host, artifact_url)
else
generic_install_msi_on(host, artifact_url)
end
when 'aix'
artifact_filename = File.basename(artifact_url)
artifact_folder = File.dirname(artifact_url)
Expand Down
15 changes: 8 additions & 7 deletions setup/common/040_ValidateSignCert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,27 @@
step "Clear SSL on all hosts"
hosts.each do |host|
ssldir = on(host, puppet('agent --configprint ssldir')).stdout.chomp
# preserve permissions for master's ssldir so puppetserver can read it
on(host, "rm -rf '#{ssldir}/*'")
end

step "Master: Start Puppet Master" do
step "Start puppetserver" do
master_opts = {
:main => {
:dns_alt_names => "puppet,#{hostname},#{fqdn}",
},
}
# server will generate the CA and server certs when it starts
with_puppet_running_on(master, master_opts) do

hosts.each do |host|
next if host['roles'].include? 'master'
agents.each do |agent|
next if agent == master

step "Agents: Run agent --test first time to gen CSR"
on host, puppet("agent --test --server #{master}"), :acceptable_exit_codes => [1]
on agent, puppet("agent --test --server #{master}"), :acceptable_exit_codes => [1]
end

# Sign all waiting certs
step "Master: sign all certs"
# Sign all waiting agent certs
step "Server: sign all agent certs"
on master, puppet("cert --sign --all"), :acceptable_exit_codes => [0,24]

step "Agents: Run agent --test second time to obtain signed cert"
Expand Down
8 changes: 8 additions & 0 deletions spec/beaker-puppet/install_utils/puppet5_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ def logger
subject.install_artifact_on(host, artifact_url, 'project_name')
end

it 'install a puppet-agent MSI from a URL on Windows' do
@platform = 'windows'

expect(subject).to receive(:install_msi_on).with(host, artifact_url)

subject.install_artifact_on(host, artifact_url, 'puppet-agent')
end

it 'install an MSI from a URL on Windows' do
@platform = 'windows'

Expand Down

0 comments on commit 92598e7

Please sign in to comment.