From: Mike Christie Date: Mon, 13 May 2019 17:59:27 +0000 (-0500) Subject: igw: Add check for mismatch ceph-iscsi and iscsigws.yml settings X-Git-Tag: v4.0.0rc10~17 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=dd4d12662b6441aa7c1ffd03fd1fc9ee2332cfbe;p=ceph-ansible.git igw: Add check for mismatch ceph-iscsi and iscsigws.yml settings If the user has manually installed ceph-iscsi but is trying to setup a iscsi object in iscsigws.yml you will just a python crash. This patch adds a check and more user friendly error message for the case. Signed-off-by: Mike Christie (cherry picked from commit 2e1a4328a85f4cee5d4e7144b8fd9e96324b5f53) --- diff --git a/library/igw_gateway.py b/library/igw_gateway.py index 2f7679447..2f56f425d 100644 --- a/library/igw_gateway.py +++ b/library/igw_gateway.py @@ -63,6 +63,7 @@ from logging.handlers import RotatingFileHandler # noqa E402 from ansible.module_utils.basic import * # noqa E402 import ceph_iscsi_config.settings as settings # noqa E402 +from ceph_iscsi_config.common import Config # noqa E402 from ceph_iscsi_config.gateway import GWTarget # noqa E402 from ceph_iscsi_config.utils import valid_ip # noqa E402 @@ -85,6 +86,15 @@ def ansible_main(): module = AnsibleModule(argument_spec=fields, # noqa F405 supports_check_mode=False) + cfg = Config(logger) + if cfg.config['version'] > 3: + module.fail_json(msg="Unsupported iscsigws.yml/iscsi-gws.yml setting " + "detected. Remove depreciated iSCSI target, LUN, " + "client, and gateway settings from " + "iscsigws.yml/iscsi-gws.yml. See " + "iscsigws.yml.sample for list of supported " + "settings") + gateway_iqn = module.params['gateway_iqn'] gateway_ip_list = module.params['gateway_ip_list'].split(',') mode = module.params['mode']