]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
igw: Add check for mismatch ceph-iscsi and iscsigws.yml settings
authorMike Christie <mchristi@redhat.com>
Mon, 13 May 2019 17:59:27 +0000 (12:59 -0500)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 4 Jul 2019 00:04:04 +0000 (00:04 +0000)
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 <mchristi@redhat.com>
(cherry picked from commit 2e1a4328a85f4cee5d4e7144b8fd9e96324b5f53)

library/igw_gateway.py

index 2f767944712906fd0e289a4c05d1cf80dcfa6c17..2f56f425d2f0691b6ce78c363b2ecdf2d1ad4637 100644 (file)
@@ -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']