-
Notifications
You must be signed in to change notification settings - Fork 112
Add support for upgrading vault when installed with archive #166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,29 +1,46 @@ | ||||
# == Class vault::install | ||||
# | ||||
class vault::install { | ||||
|
||||
$vault_bin = "${::vault::bin_dir}/vault" | ||||
|
||||
case $::vault::install_method { | ||||
'archive': { | ||||
if $::vault::manage_download_dir { | ||||
file { $::vault::download_dir: | ||||
ensure => directory, | ||||
} | ||||
'archive': { | ||||
if $::vault::manage_download_dir { | ||||
file { $::vault::download_dir: | ||||
ensure => directory, | ||||
} | ||||
} | ||||
|
||||
archive { "${::vault::download_dir}/${::vault::download_filename}": | ||||
ensure => present, | ||||
extract => true, | ||||
extract_path => $::vault::bin_dir, | ||||
source => $::vault::real_download_url, | ||||
cleanup => true, | ||||
creates => $vault_bin, | ||||
before => File['vault_binary'], | ||||
} | ||||
$_manage_file_capabilities = true | ||||
$_vault_versioned_bin = "/opt/vault-${::vault::version}/vault" | ||||
|
||||
file { "/opt/vault-${::vault::version}": | ||||
ensure => directory, | ||||
owner => 'root', | ||||
group => 'root', | ||||
mode => '0755', | ||||
} | ||||
|
||||
$_manage_file_capabilities = true | ||||
archive { "${::vault::download_dir}/${::vault::download_filename}": | ||||
ensure => present, | ||||
extract => true, | ||||
extract_path => "/opt/vault-${::vault::version}", | ||||
source => $::vault::real_download_url, | ||||
cleanup => true, | ||||
creates => $_vault_versioned_bin, | ||||
before => File['vault_binary'], | ||||
notify => Exec['install_versioned_vault'], | ||||
} | ||||
|
||||
exec { 'install_versioned_vault': | ||||
command => "/bin/cp -f ${_vault_versioned_bin} ${vault_bin}", | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason to do a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried with a symlink. But the issue is that you can't set the file_capabilities on a symlink. Keeping to the symlink path meant changing the code in other places. This was the easiest way to introduce this functionality. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rgevaert symlinks are pass-through, so whatever they link to is the mode in play. E.g., if you symlink So this is probably cleaner done as a symlink: file { $vault_bin:
ensure => link,
target => $vault_versioned_bin,
notify => Class['vault::service'],
} And let whatever mode the actual bin has be the mode in play. If it needs to be set, I believe you’ll want to do that in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH I tried that first but had issues like mentioned before. If someone else has time to pick it up, please do. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using a symlink will throw an error when setting puppet-vault/manifests/install.pp Line 66 in 97dd794
$_vault_versioned_bin instead.
|
||||
refreshonly => true, | ||||
notify => Class['vault::service'], | ||||
} | ||||
|
||||
} | ||||
|
||||
'repo': { | ||||
package { $::vault::package_name: | ||||
ensure => $::vault::package_ensure, | ||||
|
@@ -37,7 +54,7 @@ | |||
} | ||||
|
||||
file { 'vault_binary': | ||||
path => $vault_bin, | ||||
path => $vault_bin, | ||||
owner => 'root', | ||||
group => 'root', | ||||
mode => '0755', | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please split this out into its own commit as it addresses a different issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand why it should be a different commit. As when you update the binary you need to restart the service. I can do it, just want to understand why :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’d be good to have this in its own commit b/c it addresses a different new/changed functionality. Just in case it needs to be reverted separately from the addition of versioned installs.