diff options
author | John McCrae <jmccrae@chef.io> | 2021-04-13 14:38:18 -0700 |
---|---|---|
committer | John McCrae <jmccrae@chef.io> | 2021-04-13 14:38:18 -0700 |
commit | e6b3a4cea1b19ab5b8cf162dec13c21009e00e1e (patch) | |
tree | ffcadfa23e03b6b40cc58233410858319dd4cb4a | |
parent | 3572e5b94c288527593074feda46427d939a6aae (diff) | |
download | chef-e6b3a4cea1b19ab5b8cf162dec13c21009e00e1e.tar.gz |
refactored windows_certificate to properly add remove a pfx and private key, changed output for all fetch commands to require an output path instead of dumping to screen, added the ability to create
Signed-off-by: John McCrae <jmccrae@chef.io>
-rw-r--r-- | lib/chef/resource/windows_certificate.rb | 1 | ||||
-rw-r--r-- | spec/functional/resource/windows_certificate_spec.rb | 42 |
2 files changed, 0 insertions, 43 deletions
diff --git a/lib/chef/resource/windows_certificate.rb b/lib/chef/resource/windows_certificate.rb index 9f4916131e..0c9e245269 100644 --- a/lib/chef/resource/windows_certificate.rb +++ b/lib/chef/resource/windows_certificate.rb @@ -100,7 +100,6 @@ class Chef ext = get_file_extension(new_resource.source) # PFX certificates contains private keys and we import them with some other approach - import_certificates(fetch_cert_object(ext), (ext == ".pfx")) end diff --git a/spec/functional/resource/windows_certificate_spec.rb b/spec/functional/resource/windows_certificate_spec.rb index 04cd927be9..c504beb66c 100644 --- a/spec/functional/resource/windows_certificate_spec.rb +++ b/spec/functional/resource/windows_certificate_spec.rb @@ -37,7 +37,6 @@ describe Chef::Resource::WindowsCertificate, :windows_only do def certificate_count(store_location: "LocalMachine", store_name: store) powershell_exec(<<~EOC).result.to_i (Get-ChildItem -Force -Path Cert:\\#{store_location}\\#{store_name} | measure).Count -<<<<<<< HEAD EOC end @@ -50,8 +49,6 @@ describe Chef::Resource::WindowsCertificate, :windows_only do def refresh_certstore(store_location: "LocalMachine") powershell_exec(<<~EOC) Get-ChildItem -Force -Path Cert:\\#{store_location} -Recurse -======= ->>>>>>> ee0114abeba034d57630f2ac555fd480b733a9e0 EOC end @@ -302,8 +299,6 @@ describe Chef::Resource::WindowsCertificate, :windows_only do expect { resource.run_action :fetch }.to raise_error(ArgumentError) end -<<<<<<< HEAD -======= end end @@ -335,7 +330,6 @@ describe Chef::Resource::WindowsCertificate, :windows_only do resource.source = tests_thumbprint resource.pfx_password = password expect { resource.run_action :fetch }.to raise_error(::Chef::Exceptions::ResourceNotFound) ->>>>>>> ee0114abeba034d57630f2ac555fd480b733a9e0 end end @@ -376,42 +370,6 @@ describe Chef::Resource::WindowsCertificate, :windows_only do end end -<<<<<<< HEAD -======= - # describe "action: fetch pfx objects" do - # before do - # resource.source = pfx_path - # resource.pfx_password = password - # resource.exportable = true - # resource.run_action(:create) - # end - - # context "with a pfx/pkcs12 object in the store" do - # 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 - # end - ->>>>>>> ee0114abeba034d57630f2ac555fd480b733a9e0 describe "action: delete" do it "throws an argument error when attempting to delete a certificate that doesn't exist" do resource.source = tests_thumbprint |