diff --git a/library/igw_client.py b/library/igw_client.py index cdd095bae..cb6051938 100644 --- a/library/igw_client.py +++ b/library/igw_client.py @@ -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_', '') diff --git a/library/igw_gateway.py b/library/igw_gateway.py index 9c3a1d035..2f7679447 100644 --- a/library/igw_gateway.py +++ b/library/igw_gateway.py @@ -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"}) diff --git a/library/igw_lun.py b/library/igw_lun.py index 6554f3d2f..93d94b127 100644 --- a/library/igw_lun.py +++ b/library/igw_lun.py @@ -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"] diff --git a/roles/ceph-iscsi-gw/library/igw_client.py b/roles/ceph-iscsi-gw/library/igw_client.py index cdd095bae..cb6051938 100644 --- a/roles/ceph-iscsi-gw/library/igw_client.py +++ b/roles/ceph-iscsi-gw/library/igw_client.py @@ -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_', '') diff --git a/roles/ceph-iscsi-gw/library/igw_gateway.py b/roles/ceph-iscsi-gw/library/igw_gateway.py index 9c3a1d035..2f7679447 100644 --- a/roles/ceph-iscsi-gw/library/igw_gateway.py +++ b/roles/ceph-iscsi-gw/library/igw_gateway.py @@ -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"}) diff --git a/roles/ceph-iscsi-gw/library/igw_lun.py b/roles/ceph-iscsi-gw/library/igw_lun.py index 6554f3d2f..93d94b127 100644 --- a/roles/ceph-iscsi-gw/library/igw_lun.py +++ b/roles/ceph-iscsi-gw/library/igw_lun.py @@ -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"]