mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-17 21:33:11 +00:00
[PR #12238/f4339d8c backport][stable-13] java_cert: detect silent keytool failures by verifying import outcome (#12268)
java_cert: detect silent `keytool` failures by verifying import outcome (#12238)
* fix(java_cert): detect silent keytool failures by verifying import outcome
* test(java_cert): add integration tests for silent keytool failure detection
* changelog: add fragment for PR 12238
* dummy
---------
(cherry picked from commit f4339d8c0d)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d0bdd8a357
commit
9e690837bd
3 changed files with 51 additions and 1 deletions
|
|
@ -411,6 +411,14 @@ def import_pkcs12_path(
|
|||
if import_rc != 0 or not os.path.exists(keystore_path):
|
||||
module.fail_json(msg=import_out, rc=import_rc, cmd=import_cmd, error=import_err)
|
||||
|
||||
check_alias = keystore_alias or pkcs12_alias
|
||||
if check_alias:
|
||||
alias_exists, dummy = _check_cert_present(
|
||||
module, executable, keystore_path, keystore_pass, check_alias, keystore_type
|
||||
)
|
||||
if not alias_exists:
|
||||
module.fail_json(msg=import_out, rc=import_rc, cmd=import_cmd, error=import_err)
|
||||
|
||||
return dict(
|
||||
changed=True, msg=import_out, rc=import_rc, cmd=import_cmd, stdout=import_out, error=import_err, diff=diff
|
||||
)
|
||||
|
|
@ -431,7 +439,11 @@ def import_cert_path(module, executable, path, keystore_path, keystore_pass, ali
|
|||
)
|
||||
diff = {"before": "\n", "after": f"{alias}\n"}
|
||||
|
||||
if import_rc != 0:
|
||||
if import_rc != 0 or not os.path.exists(keystore_path):
|
||||
module.fail_json(msg=import_out, rc=import_rc, cmd=import_cmd, error=import_err)
|
||||
|
||||
alias_exists, dummy = _check_cert_present(module, executable, keystore_path, keystore_pass, alias, keystore_type)
|
||||
if not alias_exists:
|
||||
module.fail_json(msg=import_out, rc=import_rc, cmd=import_cmd, error=import_err)
|
||||
|
||||
return dict(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue