Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Commit a944084

Browse files
committed
Separate backinator binary from consul path
Signed-off-by: JoshVanL <vleeuwenjoshua@gmail.com>
1 parent e8d8eb3 commit a944084

File tree

3 files changed

+32
-8
lines changed

3 files changed

+32
-8
lines changed

puppet/modules/consul/manifests/init.pp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,12 @@
7676
Exec { path => $path }
7777

7878
$_dest_dir = "${dest_dir}/${app_name}-${version}"
79+
$_backinator_dest_dir = "${dest_dir}/${app_name}-backinator-${backinator_version}"
7980
$bin_path = "${_dest_dir}/${app_name}"
8081
$link_path = "${dest_dir}/bin"
8182
$config_path = "${config_dir}/consul.json"
8283

83-
$exporter_dest_dir = "${dest_dir}/${app_name}_exporter-${exporter_version}"
84+
$exporter_dest_dir = "${dest_dir}/${app_name}-exporter-${exporter_version}"
8485
$exporter_bin_path = "${exporter_dest_dir}/${app_name}_exporter"
8586

8687
$_consul_master_token = $consul_master_token ? {

puppet/modules/consul/manifests/install.pp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@
9191
extract_path => $consul::exporter_dest_dir,
9292
extract_command => 'tar xfz %s --strip-components=1'
9393
}
94+
-> file {$consul::exporter_bin_path:
95+
ensure => file,
96+
mode => '0755',
97+
}
98+
-> file {"${consul::link_path}/${consul::app_name}_exporter":
99+
ensure => link,
100+
target => $consul::exporter_bin_path,
101+
}
94102
}
95103
else {
96104
file {$consul::exporter_dest_dir:
@@ -99,22 +107,26 @@
99107
}
100108

101109

102-
archive {"${consul::_dest_dir}/consul-backinator":
110+
file {$consul::_backinator_dest_dir:
111+
ensure => directory,
112+
mode => '0755',
113+
}
114+
-> archive {"${consul::_dest_dir}/consul-backinator":
103115
ensure => present,
104116
extract => false,
105117
source => $backinator_download_url,
106118
checksum => $consul::backinator_sha256,
107119
checksum_type => 'sha256',
108120
cleanup => false,
109-
creates => "${consul::_dest_dir}/consul-backinator",
121+
creates => "${consul::_backinator_dest_dir}/consul-backinator",
110122
}
111-
-> file {"${consul::_dest_dir}/consul-backinator":
123+
-> file {"${consul::_backinator_dest_dir}/consul-backinator":
112124
ensure => file,
113125
mode => '0755',
114126
}
115127
-> file {"${consul::link_path}/${consul::app_name}-backinator":
116128
ensure => link,
117-
target => "${consul::_dest_dir}/consul-backinator",
129+
target => "${consul::_backinator_dest_dir}/consul-backinator",
118130
}
119131

120132
file { "${consul::_dest_dir}/consul-backup.sh":

puppet/modules/consul/spec/classes/install_spec.rb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,17 @@
2828
end
2929

3030
it 'should install consul exporter' do
31-
should contain_file('/opt/consul_exporter-0.3.0').with(
31+
should contain_file('/opt/consul-exporter-0.3.0').with(
3232
:ensure => 'directory',
3333
)
34+
should contain_file('/opt/consul-exporter-0.3.0/consul_exporter').with(
35+
:ensure => 'file',
36+
:mode => '0755',
37+
)
38+
should contain_file('/opt/bin/consul_exporter').with(
39+
:ensure => 'link',
40+
:target => '/opt/consul-exporter-0.3.0/consul_exporter',
41+
)
3442
end
3543

3644
it 'should install consul backup script' do
@@ -45,13 +53,16 @@
4553
end
4654

4755
it 'should install consul backinator' do
48-
should contain_file('/opt/consul-1.2.1/consul-backinator').with(
56+
should contain_file('/opt/consul-backinator-1.3').with(
57+
:ensure => 'directory',
58+
)
59+
should contain_file('/opt/consul-backinator-1.3/consul-backinator').with(
4960
:ensure => 'file',
5061
:mode => '0755',
5162
)
5263
should contain_file('/opt/bin/consul-backinator').with(
5364
:ensure => 'link',
54-
:target => '/opt/consul-1.2.1/consul-backinator',
65+
:target => '/opt/consul-backinator-1.3/consul-backinator',
5566
)
5667
end
5768
end

0 commit comments

Comments
 (0)