Skip to content

Commit

Permalink
Merge pull request #7108 from joshcooper/PUP-9159-server-status
Browse files Browse the repository at this point in the history
(PUP-9159) Request status of the master service
  • Loading branch information
joshcooper committed Sep 21, 2018
2 parents ccdc93b + 6042129 commit 9a9eed9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet/configurer.rb
Expand Up @@ -397,7 +397,7 @@ def find_functional_server
port = server[1] || Puppet[:masterport]
begin
http = Puppet::Network::HttpPool.http_ssl_instance(host, port)
response = http.get('/status/v1/simple')
response = http.get('/status/v1/simple/master')
return [host, port] if response.is_a?(Net::HTTPOK)

Puppet.debug(_("Puppet server %{host}:%{port} is unavailable: %{code} %{reason}") %
Expand Down
11 changes: 11 additions & 0 deletions spec/unit/configurer_spec.rb
Expand Up @@ -1019,6 +1019,17 @@ def expects_neither_new_or_cached_catalog
expect(options[:report].master_used).to eq('myserver:123')
end

it "queries the simple status for the 'master' service" do
Puppet.settings[:server_list] = ["myserver:123"]
response = Net::HTTPOK.new(nil, 200, 'OK')
http = mock('request')
http.expects(:get).with('/status/v1/simple/master').returns(response)
Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(http)
@agent.stubs(:run_internal)

@agent.run
end

it "should report when a server is unavailable" do
Puppet.settings[:server_list] = ["myserver:123"]
response = Net::HTTPInternalServerError.new(nil, 500, 'Internal Server Error')
Expand Down

0 comments on commit 9a9eed9

Please sign in to comment.