Skip to content

Commit

Permalink
Fixed issue #29 that version is not updated when parameter is changing
Browse files Browse the repository at this point in the history
  • Loading branch information
C24-AK committed Jun 5, 2024
1 parent 97d9d04 commit 2ce7d38
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
16 changes: 16 additions & 0 deletions lib/facter/vault_version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

# Fact: vault_version
#
# Purpose: Retrieve vault version if installed
#
Facter.add(:vault_version) do
setcode do
if Facter::Util::Resolution.which('vault')
vault_server_version_output = Facter::Util::Resolution.exec('vault version')
match = vault_server_version_output.match(%r{Vault v(\d+\.\d+\.\d+)})
match ? match.captures.first : nil
end
end
end

8 changes: 7 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
extract_path => $vault::bin_dir,
source => $vault::real_download_url,
cleanup => true,
creates => $vault_bin,
creates => $facts['vault_version'] ? { # lint:ignore:selector_inside_resource

Check failure on line 22 in manifests/install.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

there should be a single space or single newline after an opening brace (check: manifest_whitespace_opening_brace_after)
undef => $vault_bin,
default => versioncmp($vault::version, $facts['vault_version']) > 0 ? {
true => undef,
default => $vault_bin
}
},
before => File['vault_binary'],
}

Expand Down

0 comments on commit 2ce7d38

Please sign in to comment.