Skip to content

Commit

Permalink
use confine instead of if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
C24-AK committed Jun 21, 2024
1 parent 7cf05de commit 408dec4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/facter/vault_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
# Purpose: Retrieve vault version if installed
#
Facter.add(:vault_version) do
confine {Facter::Util::Resolution.which('vault')}

Check failure on line 8 in lib/facter/vault_version.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/SpaceInsideBlockBraces: Space missing inside {.

Check failure on line 8 in lib/facter/vault_version.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/SpaceInsideBlockBraces: Space missing inside }.
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&.captures&.first
end
vault_server_version_output = Facter::Util::Resolution.exec('vault version')
match = vault_server_version_output.match(%r{Vault v(\d+\.\d+\.\d+)})
match&.captures&.first
end
end

0 comments on commit 408dec4

Please sign in to comment.