diff --git a/lib/facter/vault_version.rb b/lib/facter/vault_version.rb index d1ac06d..8826e38 100644 --- a/lib/facter/vault_version.rb +++ b/lib/facter/vault_version.rb @@ -5,11 +5,10 @@ # Purpose: Retrieve vault version if installed # Facter.add(:vault_version) do + confine {Facter::Util::Resolution.which('vault')} 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