]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
iscsi module linting
authorSébastien Han <seb@redhat.com>
Tue, 30 Oct 2018 10:57:20 +0000 (11:57 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 30 Oct 2018 13:41:36 +0000 (14:41 +0100)
Fix linter issues on iscsi modules.

Signed-off-by: Sébastien Han <seb@redhat.com>
library/igw_client.py
library/igw_gateway.py
library/igw_lun.py
roles/ceph-iscsi-gw/library/igw_client.py
roles/ceph-iscsi-gw/library/igw_gateway.py
roles/ceph-iscsi-gw/library/igw_lun.py

index cdd095baedb1b9027b109dcaa55b309f0f24b388..cb60519380e0b635ec103d30a01110a536eb117e 100644 (file)
@@ -53,13 +53,14 @@ author:
 
 """
 
-import os
-import logging
-from logging.handlers import RotatingFileHandler
-from ansible.module_utils.basic import *
+import os  # noqa E402
+import logging  # noqa E402
+from logging.handlers import RotatingFileHandler  # noqa E402
+from ansible.module_utils.basic import *  # noqa E402
+
+from ceph_iscsi_config.client import GWClient  # noqa E402
+import ceph_iscsi_config.settings as settings  # noqa E402
 
-from ceph_iscsi_config.client import GWClient
-import ceph_iscsi_config.settings as settings
 
 # the main function is called ansible_main to allow the call stack
 # to be checked to determine whether the call to the ceph_iscsi_config
@@ -74,10 +75,10 @@ def ansible_main():
             "required": True,
             "choices": ['present', 'absent'],
             "type": "str"
-            },
-        }
+        },
+    }
 
-    module = AnsibleModule(argument_spec=fields,
+    module = AnsibleModule(argument_spec=fields,    # noqa F405
                            supports_check_mode=False)
 
     client_iqn = module.params['client_iqn']
@@ -113,6 +114,7 @@ def ansible_main():
                      meta={"msg": "Client definition completed {} "
                                   "changes made".format(client.change_count)})
 
+
 if __name__ == '__main__':
 
     module_name = os.path.basename(__file__).replace('ansible_module_', '')
index 9c3a1d0358143d140e79a49dd77df91ddbd91d6e..2f767944712906fd0e289a4c05d1cf80dcfa6c17 100644 (file)
@@ -56,16 +56,16 @@ author:
 
 """
 
-import os
-import logging
+import os  # noqa E402
+import logging  # noqa E402
 
-from logging.handlers import RotatingFileHandler
-from ansible.module_utils.basic import *
+from logging.handlers import RotatingFileHandler  # noqa E402
+from ansible.module_utils.basic import *  # noqa E402
 
-import ceph_iscsi_config.settings as settings
+import ceph_iscsi_config.settings as settings  # noqa E402
 
-from ceph_iscsi_config.gateway import GWTarget
-from ceph_iscsi_config.utils import valid_ip
+from ceph_iscsi_config.gateway import GWTarget  # noqa E402
+from ceph_iscsi_config.utils import valid_ip  # noqa E402
 
 
 # the main function is called ansible_main to allow the call stack
@@ -79,10 +79,10 @@ def ansible_main():
               "mode": {
                   "required": True,
                   "choices": ['target', 'map']
-                  }
-              }
+    }
+    }
 
-    module = AnsibleModule(argument_spec=fields,
+    module = AnsibleModule(argument_spec=fields,  # noqa F405
                            supports_check_mode=False)
 
     gateway_iqn = module.params['gateway_iqn']
@@ -110,7 +110,6 @@ def ansible_main():
         module.fail_json(msg="iSCSI gateway creation/load failure "
                              "({})".format(gateway.error_msg))
 
-
     logger.info("END - GATEWAY configuration complete")
     module.exit_json(changed=gateway.changes_made,
                      meta={"msg": "Gateway setup complete"})
index 6554f3d2f818ac8f6213cf63c3d1e808003de016..93d94b127b7437a5f67487995c327424a8e7f218 100644 (file)
@@ -8,11 +8,11 @@ module: igw_lun
 short_description: Manage ceph rbd images to present as iscsi LUNs to clients
 description:
   - This module calls the 'lun' configuration management module installed
-    on the iscsi gateway node(s). The lun module handles the creation and resize
+    on the iscsi gateway node(s). The lun module handles the creation and resize  # noqa E501
     of rbd images, and then maps these rbd devices to the gateway node(s) to be
     exposed through the kernel's LIO target.
 
-    To support module debugging, this module logs to /var/log/ansible-module-igw_config.log
+    To support module debugging, this module logs to /var/log/ansible-module-igw_config.log  # noqa E501
     on the target machine(s).
 
 option:
@@ -69,19 +69,21 @@ author:
   - 'Paul Cuzner'
 
 """
-import os
-import logging
-from logging.handlers import RotatingFileHandler
+import os  # noqa E402
+import logging  # noqa E402
+from logging.handlers import RotatingFileHandler  # noqa E402
 
-from ansible.module_utils.basic import *
+from ansible.module_utils.basic import *  # noqa E402
 
-from ceph_iscsi_config.lun import LUN
-from ceph_iscsi_config.utils import valid_size
-import ceph_iscsi_config.settings as settings
+from ceph_iscsi_config.lun import LUN  # noqa E402
+from ceph_iscsi_config.utils import valid_size  # noqa E402
+import ceph_iscsi_config.settings as settings  # noqa E402
 
 # the main function is called ansible_main to allow the call stack
 # to be checked to determine whether the call to the ceph_iscsi_config
 # modules is from ansible or not
+
+
 def ansible_main():
 
     # Define the fields needs to create/map rbd's the the host(s)
@@ -101,7 +103,7 @@ def ansible_main():
     }
 
     # not supporting check mode currently
-    module = AnsibleModule(argument_spec=fields,
+    module = AnsibleModule(argument_spec=fields,  # noqa F405
                            supports_check_mode=False)
 
     pool = module.params["pool"]
index cdd095baedb1b9027b109dcaa55b309f0f24b388..cb60519380e0b635ec103d30a01110a536eb117e 100644 (file)
@@ -53,13 +53,14 @@ author:
 
 """
 
-import os
-import logging
-from logging.handlers import RotatingFileHandler
-from ansible.module_utils.basic import *
+import os  # noqa E402
+import logging  # noqa E402
+from logging.handlers import RotatingFileHandler  # noqa E402
+from ansible.module_utils.basic import *  # noqa E402
+
+from ceph_iscsi_config.client import GWClient  # noqa E402
+import ceph_iscsi_config.settings as settings  # noqa E402
 
-from ceph_iscsi_config.client import GWClient
-import ceph_iscsi_config.settings as settings
 
 # the main function is called ansible_main to allow the call stack
 # to be checked to determine whether the call to the ceph_iscsi_config
@@ -74,10 +75,10 @@ def ansible_main():
             "required": True,
             "choices": ['present', 'absent'],
             "type": "str"
-            },
-        }
+        },
+    }
 
-    module = AnsibleModule(argument_spec=fields,
+    module = AnsibleModule(argument_spec=fields,    # noqa F405
                            supports_check_mode=False)
 
     client_iqn = module.params['client_iqn']
@@ -113,6 +114,7 @@ def ansible_main():
                      meta={"msg": "Client definition completed {} "
                                   "changes made".format(client.change_count)})
 
+
 if __name__ == '__main__':
 
     module_name = os.path.basename(__file__).replace('ansible_module_', '')
index 9c3a1d0358143d140e79a49dd77df91ddbd91d6e..2f767944712906fd0e289a4c05d1cf80dcfa6c17 100644 (file)
@@ -56,16 +56,16 @@ author:
 
 """
 
-import os
-import logging
+import os  # noqa E402
+import logging  # noqa E402
 
-from logging.handlers import RotatingFileHandler
-from ansible.module_utils.basic import *
+from logging.handlers import RotatingFileHandler  # noqa E402
+from ansible.module_utils.basic import *  # noqa E402
 
-import ceph_iscsi_config.settings as settings
+import ceph_iscsi_config.settings as settings  # noqa E402
 
-from ceph_iscsi_config.gateway import GWTarget
-from ceph_iscsi_config.utils import valid_ip
+from ceph_iscsi_config.gateway import GWTarget  # noqa E402
+from ceph_iscsi_config.utils import valid_ip  # noqa E402
 
 
 # the main function is called ansible_main to allow the call stack
@@ -79,10 +79,10 @@ def ansible_main():
               "mode": {
                   "required": True,
                   "choices": ['target', 'map']
-                  }
-              }
+    }
+    }
 
-    module = AnsibleModule(argument_spec=fields,
+    module = AnsibleModule(argument_spec=fields,  # noqa F405
                            supports_check_mode=False)
 
     gateway_iqn = module.params['gateway_iqn']
@@ -110,7 +110,6 @@ def ansible_main():
         module.fail_json(msg="iSCSI gateway creation/load failure "
                              "({})".format(gateway.error_msg))
 
-
     logger.info("END - GATEWAY configuration complete")
     module.exit_json(changed=gateway.changes_made,
                      meta={"msg": "Gateway setup complete"})
index 6554f3d2f818ac8f6213cf63c3d1e808003de016..93d94b127b7437a5f67487995c327424a8e7f218 100644 (file)
@@ -8,11 +8,11 @@ module: igw_lun
 short_description: Manage ceph rbd images to present as iscsi LUNs to clients
 description:
   - This module calls the 'lun' configuration management module installed
-    on the iscsi gateway node(s). The lun module handles the creation and resize
+    on the iscsi gateway node(s). The lun module handles the creation and resize  # noqa E501
     of rbd images, and then maps these rbd devices to the gateway node(s) to be
     exposed through the kernel's LIO target.
 
-    To support module debugging, this module logs to /var/log/ansible-module-igw_config.log
+    To support module debugging, this module logs to /var/log/ansible-module-igw_config.log  # noqa E501
     on the target machine(s).
 
 option:
@@ -69,19 +69,21 @@ author:
   - 'Paul Cuzner'
 
 """
-import os
-import logging
-from logging.handlers import RotatingFileHandler
+import os  # noqa E402
+import logging  # noqa E402
+from logging.handlers import RotatingFileHandler  # noqa E402
 
-from ansible.module_utils.basic import *
+from ansible.module_utils.basic import *  # noqa E402
 
-from ceph_iscsi_config.lun import LUN
-from ceph_iscsi_config.utils import valid_size
-import ceph_iscsi_config.settings as settings
+from ceph_iscsi_config.lun import LUN  # noqa E402
+from ceph_iscsi_config.utils import valid_size  # noqa E402
+import ceph_iscsi_config.settings as settings  # noqa E402
 
 # the main function is called ansible_main to allow the call stack
 # to be checked to determine whether the call to the ceph_iscsi_config
 # modules is from ansible or not
+
+
 def ansible_main():
 
     # Define the fields needs to create/map rbd's the the host(s)
@@ -101,7 +103,7 @@ def ansible_main():
     }
 
     # not supporting check mode currently
-    module = AnsibleModule(argument_spec=fields,
+    module = AnsibleModule(argument_spec=fields,  # noqa F405
                            supports_check_mode=False)
 
     pool = module.params["pool"]