diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-06-04 23:57:40 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-06-04 23:59:37 -0700 |
commit | 8652dbd2221994938a8d58e5f66f091d460e26ee (patch) | |
tree | 1753deb64dbaeecec08448656fdca8971ba0f2a7 /lib | |
parent | 69d0710481a8d5d475a812a956b8493db918404f (diff) | |
download | chef-8652dbd2221994938a8d58e5f66f091d460e26ee.tar.gz |
Change how we get the fingerprint again
It turns out the string I was matching on before was actually an error message to stderr. We can't rely on that.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/provider/zypper_repository.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/provider/zypper_repository.rb b/lib/chef/provider/zypper_repository.rb index 5c0f1928eb..d5ad8577c8 100644 --- a/lib/chef/provider/zypper_repository.rb +++ b/lib/chef/provider/zypper_repository.rb @@ -121,7 +121,7 @@ class Chef def gpg_version so = shell_out("gpg --version") # matches 2.0 and 2.2 versions from SLES 12 and 15: https://rubular.com/r/e6D0WfGK6SXvUp - version = %r{gpg \(GnuPG\)\s*(.*)}.match(so.stdout)[1] + version = /gpg \(GnuPG\)\s*(.*)/.match(so.stdout)[1] logger.trace("GPG package version is #{version}") Gem::Version.new(version) end @@ -144,9 +144,9 @@ class Chef # @return [String] the fingerprint of the key def key_fingerprint(key_path) if gpg_version >= Gem::Version.new("2.2") # SLES 15+ - so = shell_out!("gpg --import-options import-show --dry-run --import #{key_path}") - # expected output and match: https://rubular.com/r/WARlJQBo0IdP7h - fingerprint = %r{key \h*(\h{8}):}.match(so.stdout)[1].downcase + so = shell_out!("gpg --import-options import-show --dry-run --import --with-colons #{key_path}") + # expected output and match: https://rubular.com/r/uXWJo3yfkli1qA + fingerprint = /fpr:*\h*(\h{8}):/.match(so.stdout)[1].downcase else # SLES 12 and earlier so = shell_out!("gpg --with-fingerprint #{key_path}") # expected output and match: http://rubular.com/r/BpfMjxySQM |