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

Commit

Permalink
Merge pull request #799 from JoshVanL/798-fix-consul-backinator-install
Browse files Browse the repository at this point in the history
Fixes the installation of consul-backinator
  • Loading branch information
jetstack-bot authored May 7, 2019
2 parents 291d364 + 90b3b3b commit 7b521f8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion puppet/modules/consul/files/consul-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

backup_local_path=/tmp/consul-backup
backup_local_acls_path=/tmp/consul-backup-acls
consul-backinator backup -file "${backup_local_path}" -acls "${backup_local_acls_path}"
/opt/bin/consul-backinator backup -file "${backup_local_path}" -acls "${backup_local_acls_path}"
backup_s3_prefix="s3://${BUCKET_NAME}/consul-backup-$(date -u +"%Y-%m-%d_%H-%M-%S")"
backup_s3_path="${backup_s3_prefix}/consul-backup"
backup_s3_acls_path="${backup_s3_prefix}/consul-backup-acls"
Expand Down
1 change: 1 addition & 0 deletions puppet/modules/consul/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@

$_dest_dir = "${dest_dir}/${app_name}-${version}"
$_backinator_dest_dir = "${dest_dir}/${app_name}-backinator-${backinator_version}"
$_backinator_dest_path = "${_backinator_dest_dir}/${app_name}-backinator"
$bin_path = "${_dest_dir}/${app_name}"
$link_path = "${dest_dir}/bin"
$config_path = "${config_dir}/consul.json"
Expand Down
24 changes: 14 additions & 10 deletions puppet/modules/consul/manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -106,27 +106,31 @@
}
}


file {$consul::_backinator_dest_dir:
ensure => directory,
mode => '0755',
}
-> archive {"${consul::_dest_dir}/consul-backinator":
ensure => present,
extract => false,
source => $backinator_download_url,
checksum => $consul::backinator_sha256,
checksum_type => 'sha256',
cleanup => false,
creates => "${consul::_backinator_dest_dir}/consul-backinator",
ensure => present,
extract => true,
source => $backinator_download_url,
cleanup => false,
checksum => $consul::backinator_sha256,
checksum_type => 'sha256',
extract_command => 'tar xfz %s --strip-components=2',
extract_path => $consul::_backinator_dest_dir,
}
-> exec {"${consul::_dest_dir}/consul-backinator":
command => "mv ${consul::_backinator_dest_path}-${consul::backinator_version} ${consul::_backinator_dest_path}",
onlyif => "test -e ${consul::_backinator_dest_path}-${consul::backinator_version}",
}
-> file {"${consul::_backinator_dest_dir}/consul-backinator":
-> file {$consul::_backinator_dest_path:
ensure => file,
mode => '0755',
}
-> file {"${consul::link_path}/${consul::app_name}-backinator":
ensure => link,
target => "${consul::_backinator_dest_dir}/consul-backinator",
target => $consul::_backinator_dest_path,
}

file { "${consul::_dest_dir}/consul-detect-existing-datacenter.sh":
Expand Down
4 changes: 2 additions & 2 deletions puppet/modules/consul/manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$app_name = 'consul'
$version = '1.2.4'
$exporter_version = '0.3.0'
$backinator_version = '1.3'
$backinator_version = '1.6.5'
$download_dir = '/tmp'
$systemd_dir = '/etc/systemd/system'
$data_dir = '/var/lib/consul'
Expand All @@ -19,5 +19,5 @@
$exporter_download_url = 'https://github.com/prometheus/consul_exporter/releases/download/v#VERSION#/consul_exporter-#VERSION#.linux-amd64.tar.gz'
$exporter_signature_url = 'https://releases.tarmak.io/signatures/consul_exporter/#VERSION#/consul_exporter-#VERSION#.linux-amd64.tar.gz.asc'
$backinator_download_url = 'https://github.com/myENA/consul-backinator/releases/download/v#VERSION#/consul-backinator-#VERSION#-amd64-linux.tar.gz'
$backinator_sha256 = '8ea624487a86007825884685dbc978ba87f7a448f11d59b9eb29fd5b1b2a0e87'
$backinator_sha256 = 'f48e92560d5d3cb9acf525e72b2bb861794cbd7fed6ebb670108b6c35a07bc77'
}
6 changes: 3 additions & 3 deletions puppet/modules/consul/spec/classes/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@
end

it 'should install consul backinator' do
should contain_file('/opt/consul-backinator-1.3').with(
should contain_file('/opt/consul-backinator-1.6.5').with(
:ensure => 'directory',
)
should contain_file('/opt/consul-backinator-1.3/consul-backinator').with(
should contain_file('/opt/consul-backinator-1.6.5/consul-backinator').with(
:ensure => 'file',
:mode => '0755',
)
should contain_file('/opt/bin/consul-backinator').with(
:ensure => 'link',
:target => '/opt/consul-backinator-1.3/consul-backinator',
:target => '/opt/consul-backinator-1.6.5/consul-backinator',
)
end
end
Expand Down

0 comments on commit 7b521f8

Please sign in to comment.