Skip to content

Commit

Permalink
Merge pull request #418 from david22swan/CONT-186/main
Browse files Browse the repository at this point in the history
(CONT-186) Set `-deststoretype`
  • Loading branch information
LukasAud authored Nov 21, 2022
2 parents f845b0d + 3435f1d commit 00d1dde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/puppet/provider/java_ks/keytool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def import_ks
]
cmd << '-trustcacerts' if @resource[:trustcacerts] == :true
cmd += ['-destkeypass', @resource[:destkeypass]] unless @resource[:destkeypass].nil?
cmd += ['-deststoretype', storetype] unless storetype.nil?

pwfile = password_file
run_command(cmd, @resource[:target], pwfile)
Expand Down
6 changes: 4 additions & 2 deletions spec/unit/puppet/provider/java_ks/keytool_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@
it 'executes openssl and keytool with specific options' do
expect(provider).to receive(:to_pkcs12).with("#{temp_dir}testing.stuff")
expect(provider).to receive(:run_command).with(['mykeytool', '-importkeystore', '-srcstoretype', 'PKCS12', '-destkeystore',
resource[:target], '-srckeystore', "#{temp_dir}testing.stuff", '-alias', resource[:name]], any_args)
resource[:target], '-srckeystore', "#{temp_dir}testing.stuff", '-alias',
resource[:name], '-deststoretype', :jceks], any_args)
provider.import_ks
end

Expand All @@ -161,7 +162,8 @@
dkp[:destkeypass] = 'keypass'
expect(provider).to receive(:to_pkcs12).with("#{temp_dir}testing.stuff")
expect(provider).to receive(:run_command).with(['mykeytool', '-importkeystore', '-srcstoretype', 'PKCS12', '-destkeystore',
dkp[:target], '-srckeystore', "#{temp_dir}testing.stuff", '-alias', dkp[:name], '-destkeypass', dkp[:destkeypass]], any_args)
dkp[:target], '-srckeystore', "#{temp_dir}testing.stuff", '-alias', dkp[:name],
'-destkeypass', dkp[:destkeypass], '-deststoretype', dkp[:storetype]], any_args)
provider.import_ks
end
end
Expand Down

0 comments on commit 00d1dde

Please sign in to comment.