Skip to content

Commit d94d559

Browse files
committed
feature: add version check
1 parent 426face commit d94d559

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

ibmsecurity/isam/appliance.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,22 @@ def _changes_available(isamAppliance):
5656
return False
5757

5858

59-
def commit(isamAppliance, check_mode=False, force=False):
59+
def commit(isamAppliance, publish=False, check_mode=False, force=False):
6060
"""
6161
Commit the current pending changes.
6262
"""
63-
if force is True or _changes_available(isamAppliance) is True:
64-
if check_mode is True:
63+
if force or _changes_available(isamAppliance):
64+
if check_mode:
6565
return isamAppliance.create_return_object(changed=True)
6666
else:
67-
return isamAppliance.invoke_put("Committing the changes",
67+
iviaVersion = isamAppliance.facts['version']
68+
if publish and ibmsecurity.utilities.tools.version_compare(iviaVersion, "10.0.8.0") >= 0:
69+
logger.debug("Publishing")
70+
return isamAppliance.invoke_put("Committing the changes (containers)",
71+
f"/isam/pending_changes?publish={publish}",
72+
{})
73+
else:
74+
return isamAppliance.invoke_put("Committing the changes",
6875
"/isam/pending_changes",
6976
{})
7077

0 commit comments

Comments
 (0)