Skip to content

Commit

Permalink
Merge pull request #179 from mdelagrange/consul-reload-fix-2
Browse files Browse the repository at this point in the history
fix 'consul reload' on custom rpc port
  • Loading branch information
solarkennedy committed Aug 25, 2015
2 parents 3128b47 + cba89ed commit 8cd0af1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifests/reload_service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
if $consul::manage_service == true and $consul::service_ensure == 'running' {
exec { 'reload consul service':
path => [$consul::bin_dir,'/bin','/usr/bin'],
command => 'consul reload',
command => "consul reload -rpc-addr=${consul::rpc_addr}:${consul::rpc_port}",
refreshonly => true,
}
}
Expand Down
50 changes: 50 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,56 @@
it { should contain_file('/etc/init/consul.conf').with_content(/env GROUP=custom_consul_group/) }
end

context "When consul is reloaded" do
let (:params) {{
:services => {
'test_service1' => {}
}
}}
let (:facts) {{
:ipaddress_lo => '127.0.0.1'
}}
it {
should contain_exec('reload consul service').
with_command('consul reload -rpc-addr=127.0.0.1:8400')
}
end

context "When consul is reloaded on a custom port" do
let (:params) {{
:services => {
'test_service1' => {}
},
:config_hash => {
'ports' => {
'rpc' => '9999'
},
'addresses' => {
'rpc' => 'consul.example.com'
}
}
}}
it {
should contain_exec('reload consul service').
with_command('consul reload -rpc-addr=consul.example.com:9999')
}
end

context "When consul is reloaded with a default client_addr" do
let (:params) {{
:services => {
'test_service1' => {}
},
:config_hash => {
'client_addr' => '192.168.34.56',
}
}}
it {
should contain_exec('reload consul service').
with_command('consul reload -rpc-addr=192.168.34.56:8400')
}
end

context "When the user provides a hash of services" do
let (:params) {{
:services => {
Expand Down

0 comments on commit 8cd0af1

Please sign in to comment.