summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCrae <jmccrae@chef.io>2021-04-15 16:34:09 -0700
committerJohn McCrae <jmccrae@chef.io>2021-04-15 16:34:09 -0700
commit79c1eb19f00d7febafd0428fc9c33069c0f7fd74 (patch)
tree7250682f100edce09ac0ec8d96455cbad1869d60
parent65cc0a611f29dbbb9ba7b6c27dbeb7067f4781f9 (diff)
downloadchef-79c1eb19f00d7febafd0428fc9c33069c0f7fd74.tar.gz
updated to the correct version of the win32-certstore gem, refactored the spec to remove code that was previously removed but showed up again, removed a random unnecessary comment from the resource
Signed-off-by: John McCrae <jmccrae@chef.io>
-rw-r--r--Gemfile.lock4
-rw-r--r--chef-universal-mingw32.gemspec2
-rw-r--r--lib/chef/resource/windows_certificate.rb2
-rw-r--r--spec/functional/resource/windows_certificate_spec.rb31
4 files changed, 4 insertions, 35 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index c7d0687a79..7cb34ec42d 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -109,7 +109,7 @@ PATH
tty-table (~> 0.11)
uuidtools (>= 2.1.5, < 3.0)
win32-api (~> 1.5.3)
- win32-certstore (~> 0.6.1)
+ win32-certstore (~> 0.6.2)
win32-event (~> 0.6.1)
win32-eventlog (= 0.6.3)
win32-mmap (~> 0.4.1)
@@ -378,7 +378,7 @@ GEM
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.7.0)
win32-api (1.5.3-universal-mingw32)
- win32-certstore (0.6.1)
+ win32-certstore (0.6.2)
ffi
mixlib-shellout
win32-event (0.6.3)
diff --git a/chef-universal-mingw32.gemspec b/chef-universal-mingw32.gemspec
index 66f89da97f..329b4f9d6b 100644
--- a/chef-universal-mingw32.gemspec
+++ b/chef-universal-mingw32.gemspec
@@ -14,7 +14,7 @@ gemspec.add_dependency "win32-service", ">= 2.1.5", "< 3.0"
gemspec.add_dependency "wmi-lite", "~> 1.0"
gemspec.add_dependency "win32-taskscheduler", "~> 2.0"
gemspec.add_dependency "iso8601", ">= 0.12.1", "< 0.14" # validate 0.14 when it comes out
-gemspec.add_dependency "win32-certstore", "~> 0.6.1" # 0.5+ required for specifying user vs. system store
+gemspec.add_dependency "win32-certstore", "~> 0.6.2" # 0.5+ required for specifying user vs. system store
gemspec.extensions << "ext/win32-eventlog/Rakefile"
gemspec.files += Dir.glob("{distro,ext}/**/*")
diff --git a/lib/chef/resource/windows_certificate.rb b/lib/chef/resource/windows_certificate.rb
index 2f3c87d146..b0e6c2eff2 100644
--- a/lib/chef/resource/windows_certificate.rb
+++ b/lib/chef/resource/windows_certificate.rb
@@ -193,7 +193,7 @@ class Chef
store = ::Win32::Certstore.open(new_resource.store_name, store_location: native_cert_location)
if new_resource.output_path && ::File.extname(new_resource.output_path) == ".key"
fetch_key
- # store.get_key(resolve_thumbprint(new_resource.source), store_name: new_resource.store_name, store_location: ps_cert_location)
+
else
store.get(resolve_thumbprint(new_resource.source), store_name: new_resource.store_name, store_location: native_cert_location)
end
diff --git a/spec/functional/resource/windows_certificate_spec.rb b/spec/functional/resource/windows_certificate_spec.rb
index 5c336d216a..aaa31f0bdd 100644
--- a/spec/functional/resource/windows_certificate_spec.rb
+++ b/spec/functional/resource/windows_certificate_spec.rb
@@ -304,37 +304,6 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
context "with a pfx/pkcs12 object in the store" do
before do
- resource.source = pfx_path
- resource.pfx_password = password
- resource.exportable = true
- resource.run_action(:create)
- end
-
- it "exports a PFX file with a valid thumbprint" do
- resource.source = tests_thumbprint
- resource.pfx_password = password
- resource.output_path = pfx_output_path
- resource.run_action(:fetch)
- expect(File.exist?(pfx_output_path)).to be_truthy
- end
-
- it "exports a key file with a valid thumbprint" do
- resource.source = tests_thumbprint
- resource.pfx_password = password
- resource.output_path = key_output_path
- resource.run_action(:fetch)
- expect(File.exist?(key_output_path)).to be_truthy
- end
-
- it "throws an exception when output_path is not specified" do
- resource.source = tests_thumbprint
- resource.pfx_password = password
- expect { resource.run_action :fetch }.to raise_error(::Chef::Exceptions::ResourceNotFound)
- end
- end
-
- context "with a pfx/pkcs12 object in the store" do
- before do
create_store
refresh_certstore
resource.source = pfx_path