summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-12-29 17:21:32 -0800
committerTim Smith <tsmith84@gmail.com>2020-12-30 11:44:02 -0800
commitf16f84cfdc5f4b77ea8d314113049c4ecccb01cb (patch)
treecb1a42747d2a6187cd2ec167b4b0d6684d373bb4
parentde81f3c081886d4ea9ddc143ea9e0911a9c24cf2 (diff)
downloadchef-f16f84cfdc5f4b77ea8d314113049c4ecccb01cb.tar.gz
Avoid a shell_out call and just use File.binread.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
-rw-r--r--lib/chef/resource/windows_certificate.rb12
1 files changed, 1 insertions, 11 deletions
diff --git a/lib/chef/resource/windows_certificate.rb b/lib/chef/resource/windows_certificate.rb
index f535b3f105..5800fe0f45 100644
--- a/lib/chef/resource/windows_certificate.rb
+++ b/lib/chef/resource/windows_certificate.rb
@@ -309,11 +309,7 @@ class Chef
# @raise [OpenSSL::PKCS12::PKCS12Error] When incorrect password is provided for PFX certificate
#
def fetch_cert_object(ext)
- contents = if binary_cert?
- ::File.binread(new_resource.source)
- else
- ::File.read(new_resource.source)
- end
+ contents = ::File.binread(new_resource.source)
case ext
when ".pfx"
@@ -330,12 +326,6 @@ class Chef
end
end
- # @return [Boolean] Whether the certificate file is binary encoded or not
- #
- def binary_cert?
- shell_out!("file -b --mime-encoding #{new_resource.source}").stdout.strip == "binary"
- end
-
# Imports the certificate object into cert store
#
# @param cert_objs [OpenSSL::X509::Certificate] Object containing certificate's attributes