Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #266 from ripienaar/265
Browse files Browse the repository at this point in the history
(#265) Correctly use choria.puppetca_port config option
  • Loading branch information
ripienaar committed May 8, 2017
2 parents 5cb46ea + de38ff7 commit eca442d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
|Date |Issue |Description |
|----------|------|---------------------------------------------------------------------------------------------------------|
|2017/05/08|265 |Consult `choria.puppetca_port` configuration when resolving the CA |
|2017/05/04|152 |Add a etcd data store |
|2017/04/19|258 |Show the embedded certname and compare it with the configured certname |
|2017/04/18| |Release 0.0.26 |
Expand Down
6 changes: 4 additions & 2 deletions lib/mcollective/util/choria.rb
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,13 @@ def puppet_server
#
# @return [Hash] with :target and :port
def puppetca_server
d_port = get_option("choria.puppetca_port", "8140")

if @ca
{:target => @ca, :port => "8140"}
{:target => @ca, :port => d_port}
else
d_host = get_option("choria.puppetca_host", "puppet")
try_srv(["_x-puppet-ca._tcp", "_x-puppet._tcp"], d_host, "8140")
try_srv(["_x-puppet-ca._tcp", "_x-puppet._tcp"], d_host, d_port)
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/unit/mcollective/util/choria_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,10 @@ module Util
it "should query SRV" do
Config.instance.stubs(:pluginconf).returns(
"choria.puppetca_host" => "rspec.puppetca",
"choria.puppetca_port" => "8140"
"choria.puppetca_port" => "8141"
)
resolved = {:target => "rspec.puppetca", :port => 8144}
choria.expects(:try_srv).with(["_x-puppet-ca._tcp", "_x-puppet._tcp"], "rspec.puppetca", "8140").returns(resolved)
choria.expects(:try_srv).with(["_x-puppet-ca._tcp", "_x-puppet._tcp"], "rspec.puppetca", "8141").returns(resolved)

expect(choria.puppetca_server).to eq(resolved)
end
Expand Down

0 comments on commit eca442d

Please sign in to comment.