mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-23 12:33:59 -07:00
java_keystore: simplify code (#10905)
* java_keystore: simplify code * add changelog frag
This commit is contained in:
parent
b85e263466
commit
8a1ed41fe5
2 changed files with 3 additions and 5 deletions
2
changelogs/fragments/10905-java-keystore-simplify.yml
Normal file
2
changelogs/fragments/10905-java-keystore-simplify.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- java_keystore - remove redundant function (https://github.com/ansible-collections/community.general/pull/10905).
|
|
@ -259,7 +259,7 @@ class JavaKeystore:
|
||||||
except (OSError, ValueError) as e:
|
except (OSError, ValueError) as e:
|
||||||
self.module.fail_json(msg="Unable to read the provided certificate: %s" % to_native(e))
|
self.module.fail_json(msg="Unable to read the provided certificate: %s" % to_native(e))
|
||||||
|
|
||||||
fp = hex_decode(cert.fingerprint(hashes.SHA256())).upper()
|
fp = cert.fingerprint(hashes.SHA256()).hex().upper()
|
||||||
fingerprint = ':'.join([fp[i:i + 2] for i in range(0, len(fp), 2)])
|
fingerprint = ':'.join([fp[i:i + 2] for i in range(0, len(fp), 2)])
|
||||||
else:
|
else:
|
||||||
current_certificate_fingerprint_cmd = [
|
current_certificate_fingerprint_cmd = [
|
||||||
|
@ -507,10 +507,6 @@ def create_file(content):
|
||||||
return tmpfile
|
return tmpfile
|
||||||
|
|
||||||
|
|
||||||
def hex_decode(s):
|
|
||||||
return s.hex()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
choose_between = (['certificate', 'certificate_path'],
|
choose_between = (['certificate', 'certificate_path'],
|
||||||
['private_key', 'private_key_path'])
|
['private_key', 'private_key_path'])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue