-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(PE-14934) Add more robust puppetdb check #3
Merged
tvpartytonight
merged 1 commit into
puppetlabs:master
from
demophoon:fix/master/pe-14934-robust-puppetdb-check
Apr 5, 2016
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
require "beaker/dsl/install_utils/#{lib}" | ||
end | ||
require "beaker-answers" | ||
require "timeout" | ||
module Beaker | ||
module DSL | ||
module InstallUtils | ||
|
@@ -443,17 +444,20 @@ def do_install hosts, opts = {} | |
# Wait for PuppetDB to be totally up and running (post 3.0 version of pe only) | ||
sleep_until_puppetdb_started(database) unless pre30database | ||
|
||
# Run the agent once to ensure everything is in the dashboard | ||
install_hosts.each do |host| | ||
on host, puppet_agent('-t'), :acceptable_exit_codes => [0,2] | ||
|
||
# Workaround for PE-1105 when deploying 3.0.0 | ||
# The installer did not respect our database host answers in 3.0.0, | ||
# and would cause puppetdb to be bounced by the agent run. By sleeping | ||
# again here, we ensure that if that bounce happens during an upgrade | ||
# test we won't fail early in the install process. | ||
if host['pe_ver'] == '3.0.0' and host == database | ||
sleep_until_puppetdb_started(database) | ||
step "First puppet agent run" do | ||
# Run the agent once to ensure everything is in the dashboard | ||
install_hosts.each do |host| | ||
on host, puppet_agent('-t'), :acceptable_exit_codes => [0,2] | ||
|
||
# Workaround for PE-1105 when deploying 3.0.0 | ||
# The installer did not respect our database host answers in 3.0.0, | ||
# and would cause puppetdb to be bounced by the agent run. By sleeping | ||
# again here, we ensure that if that bounce happens during an upgrade | ||
# test we won't fail early in the install process. | ||
if host == database && ! pre30database | ||
sleep_until_puppetdb_started(database) | ||
check_puppetdb_status_endpoint(database) | ||
end | ||
end | ||
end | ||
|
||
|
@@ -471,15 +475,18 @@ def do_install hosts, opts = {} | |
on dashboard, "/opt/puppet/bin/rake -sf /opt/puppet/share/puppet-dashboard/Rakefile #{task} RAILS_ENV=production" | ||
end | ||
|
||
# Now that all hosts are in the dashbaord, run puppet one more | ||
# time to configure mcollective | ||
install_hosts.each do |host| | ||
on host, puppet_agent('-t'), :acceptable_exit_codes => [0,2] | ||
# To work around PE-14318 if we just ran puppet agent on the | ||
# database node we will need to wait until puppetdb is up and | ||
# running before continuing | ||
if host == database | ||
sleep_until_puppetdb_started(database) | ||
step "Final puppet agent run" do | ||
# Now that all hosts are in the dashbaord, run puppet one more | ||
# time to configure mcollective | ||
install_hosts.each do |host| | ||
on host, puppet_agent('-t'), :acceptable_exit_codes => [0,2] | ||
# To work around PE-14318 if we just ran puppet agent on the | ||
# database node we will need to wait until puppetdb is up and | ||
# running before continuing | ||
if host == database && ! pre30database | ||
sleep_until_puppetdb_started(database) | ||
check_puppetdb_status_endpoint(database) | ||
end | ||
end | ||
end | ||
end | ||
|
@@ -540,6 +547,22 @@ def install_pe | |
install_pe_on(hosts, options) | ||
end | ||
|
||
def check_puppetdb_status_endpoint(host) | ||
if version_is_less(host['pe_ver'], '2016.1.0') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could inline this conditional. |
||
return true | ||
end | ||
Timeout.timeout(60) do | ||
match = nil | ||
while not match | ||
output = on(host, "curl -s http://localhost:8080/pdb/meta/v1/version", :accept_all_exit_codes => true) | ||
match = output.stdout =~ /version.*\d+\.\d+\.\d+/ | ||
sleep 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if at first you don't succeed... |
||
end | ||
end | ||
rescue Timeout::Error | ||
fail_test "PuppetDB took too long to start" | ||
end | ||
|
||
#Install PE based upon host configuration and options | ||
# | ||
# @param [Host, Array<Host>] install_hosts One or more hosts to act upon | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Britt and I are discussing that we probably need to gate this function only to run on 2016.1.x, since the status end point won't be there for all versions.