Skip to content

Commit 7745525

Browse files
committed
fix: indentation
1 parent d35e993 commit 7745525

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

docs/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Manual change log
22

33
## Latest
4+
- fix: certificate_databases : python syntax (indentation)
45

56
## 2025.6.3.0
67

ibmsecurity/isam/base/ssl_certificates/certificate_databases.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def create(isamAppliance, kdb_name, type='kdb',
8383
"""
8484
warnings = []
8585
if force or not _check(isamAppliance, kdb_name):
86+
logger.debug("Creating new keystore")
8687
if check_mode:
8788
return isamAppliance.create_return_object(changed=True)
8889
else:
@@ -126,16 +127,22 @@ def create(isamAppliance, kdb_name, type='kdb',
126127
json_data.pop("rfs_port", None)
127128
json_data.pop("rfs_auth", None)
128129

129-
retObj = isamAppliance.invoke_post( f"Creating certificate database {kdb_name}",
130+
retObj = isamAppliance.invoke_post( f"Creating certificate database {kdb_name}",
130131
"/isam/ssl_certificates",
131132
json_data,
132133
warnings=warnings,
133134
ignore_error=True
134135
)
135-
if retObj.get("rc", 0) == 400:
136+
if retObj.get("rc", 0) == 400:
136137
warnings.append(f"Invalid type (you need to install an extension to support network hsm {type})")
137138
return isamAppliance.create_return_object(warnings=warnings)
138-
else:
139+
elif retObj.get("rc", 0) > 400 and retObj.get("rc", 0) < 500:
140+
warnings.append(f"HTTP error !")
141+
return isamAppliance.create_return_object(warnings=warnings)
142+
elif retObj.get("rc", 0) >= 500 and retObj.get("rc", 0) < 600:
143+
warnings.append(f"Server error !")
144+
return isamAppliance.create_return_object(warnings=warnings)
145+
else:
139146
return retObj
140147

141148
return isamAppliance.create_return_object()
@@ -243,7 +250,7 @@ def set(isamAppliance, cert_id, description=None, type="kdb", check_mode=False,
243250
warnings = []
244251
desc_match = True # This will remain True even when cert db is not found!
245252

246-
if type == "kdb":
253+
if type in ("p12", "kdb"):
247254
if not force:
248255
if description is None:
249256
desc_match = True
@@ -302,11 +309,12 @@ def _check(isamAppliance, id):
302309
Check if certificate database already exists
303310
"""
304311
ret_obj = get_all(isamAppliance)
305-
312+
logger.debug(f"\nCHECKING IF {id} EXISTS")
306313
for certdb in ret_obj['data']:
314+
logger.info("Cert databases id " + certdb['id'])
307315
if certdb['id'] == id:
308316
return True
309-
317+
logger.debug(f"\n{id} DOES NOT EXIST\n")
310318
return False
311319

312320

0 commit comments

Comments
 (0)