Skip to content

Commit

Permalink
PE-19888 Add workaround for 2016.1.1 console service status check error
Browse files Browse the repository at this point in the history
During installation, a classifier-service check is done in beaker-pe
to make sure console service is up and running. The classifier status
service at the default detail level is broken in 2016.1.1 (PE-14857)
and returns an error and state "unknown". The workaround is to query
the classifier-service at 'critical' level and check for the console
service status.
  • Loading branch information
shaigy committed Mar 22, 2017
1 parent f22ac7f commit 6cd41e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/beaker-pe/install/pe_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -838,9 +838,14 @@ def check_console_status_endpoint(host)
return true if version_is_less(host['pe_ver'], '2015.2.0')

attempts_limit = options[:pe_console_status_attempts] || 9
# Workaround for PE-14857. The classifier status service at the
# default level is broken in 2016.1.1. Instead we need to query
# the classifier service at critical level and check for service
# status
query_params = (host['pe_ver'] == '2016.1.1' ? '?level=critical' : '')
step 'Check Console Status Endpoint' do
match = repeat_fibonacci_style_for(attempts_limit) do
output = on(host, "curl -s -k https://localhost:4433/status/v1/services --cert /etc/puppetlabs/puppet/ssl/certs/#{host}.pem --key /etc/puppetlabs/puppet/ssl/private_keys/#{host}.pem --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem", :accept_all_exit_codes => true)
output = on(host, "curl -s -k https://localhost:4433/status/v1/services#{query_params} --cert /etc/puppetlabs/puppet/ssl/certs/#{host}.pem --key /etc/puppetlabs/puppet/ssl/private_keys/#{host}.pem --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem", :accept_all_exit_codes => true)
begin
output = JSON.parse(output.stdout)
match = output['classifier-service']['state'] == 'running'
Expand Down
10 changes: 10 additions & 0 deletions spec/beaker-pe/install/pe_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,16 @@ def slice_installer_options(host)
subject.check_console_status_endpoint({})
end

it 'add query param to curling url if version is 2016.1.1' do
unixhost[:pe_ver] = '2016.1.1'
allow(subject).to receive(:options).and_return({})
allow(subject).to receive(:version_is_less).and_return(false)
json_hash = '{ "classifier-service": { "state": "running" }, "rbac-service": { "state": "running" }, "activity-service": { "state": "running" } }'
result = double(Beaker::Result, :stdout => "#{json_hash}")
expect(subject).to receive(:on).with( anything, /services\?level=critical/, anything).and_return(result)
subject.check_console_status_endpoint(unixhost)
end

it 'yields false to repeat_fibonacci_style_for when conditions are not true' do
allow(subject).to receive(:options).and_return({})
allow(subject).to receive(:version_is_less).and_return(false)
Expand Down

0 comments on commit 6cd41e4

Please sign in to comment.