From b8a91913bcaceff4ae74428ebc5d7b0fbf01b1c0 Mon Sep 17 00:00:00 2001 From: Bert Willekens Date: Tue, 1 Aug 2023 16:48:51 +0200 Subject: [PATCH] Fix for unwanted cfgenable. According to documentation there should be no cfg_enable when active_cfg is empty. --- utils/brocade_zoning.py | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/utils/brocade_zoning.py b/utils/brocade_zoning.py index 647f7da..0920f65 100644 --- a/utils/brocade_zoning.py +++ b/utils/brocade_zoning.py @@ -741,17 +741,11 @@ def zoning_common(fos_ip_addr, https, fos_version, auth, vfid, result, module, i if active_cfg is None: if need_to_save: if not module.check_mode: - # if something changed and there is already an active cfg - # reenable that cfg + # Just save config when there is no active_cfg value. + # According to documentation of module brocade_zoning_cfg. ret_code = 0 - failed_msg = "" - if cfgname is not None: - failed_msg = "CFG ENABLE failed" - ret_code = cfg_enable(fos_ip_addr, https, fos_version, auth, vfid, - result, checksum, cfgname, timeout) - else: - failed_msg = "CFG SAVE failed" - ret_code = cfg_save(fos_ip_addr, https, fos_version, auth, vfid, + failed_msg = "CFG SAVE failed" + ret_code = cfg_save(fos_ip_addr, https, fos_version, auth, vfid, result, checksum, timeout) if ret_code != 0: ret_code = cfg_abort(fos_ip_addr, https, fos_version, @@ -802,15 +796,11 @@ def zoning_common(fos_ip_addr, https, fos_version, auth, vfid, result, module, i if active_cfg is None: if need_to_save: if not module.check_mode: + # Just save config when there is no active_cfg value. + # According to documentation of module brocade_zoning_cfg. ret_code = 0 - failed_msg = "" - if cfgname is not None: - failed_msg = "CFG ENABLE failed" - ret_code = cfg_enable(fos_ip_addr, https, fos_version, auth, vfid, - result, checksum, cfgname, timeout) - else: - failed_msg = "CFG SAVE failed" - ret_code = cfg_save(fos_ip_addr, https, fos_version, auth, vfid, + failed_msg = "CFG SAVE failed" + ret_code = cfg_save(fos_ip_addr, https, fos_version, auth, vfid, result, checksum, timeout) if ret_code != 0: ret_code = cfg_abort(fos_ip_addr, https, fos_version, auth,