iscsi module linting

Fix linter issues on iscsi modules.

Signed-off-by: Sébastien Han <seb@redhat.com>
pull/3275/head
Sébastien Han 2018-10-30 11:57:20 +01:00 committed by Guillaume Abrioux
parent d209fc9d02
commit fd72f1dd0d
6 changed files with 66 additions and 60 deletions

View File

@ -53,13 +53,14 @@ author:
""" """
import os import os # noqa E402
import logging import logging # noqa E402
from logging.handlers import RotatingFileHandler 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.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 # 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 # to be checked to determine whether the call to the ceph_iscsi_config
@ -77,7 +78,7 @@ def ansible_main():
}, },
} }
module = AnsibleModule(argument_spec=fields, module = AnsibleModule(argument_spec=fields, # noqa F405
supports_check_mode=False) supports_check_mode=False)
client_iqn = module.params['client_iqn'] client_iqn = module.params['client_iqn']
@ -113,6 +114,7 @@ def ansible_main():
meta={"msg": "Client definition completed {} " meta={"msg": "Client definition completed {} "
"changes made".format(client.change_count)}) "changes made".format(client.change_count)})
if __name__ == '__main__': if __name__ == '__main__':
module_name = os.path.basename(__file__).replace('ansible_module_', '') module_name = os.path.basename(__file__).replace('ansible_module_', '')

View File

@ -56,16 +56,16 @@ author:
""" """
import os import os # noqa E402
import logging import logging # noqa E402
from logging.handlers import RotatingFileHandler from logging.handlers import RotatingFileHandler # noqa E402
from ansible.module_utils.basic import * 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.gateway import GWTarget # noqa E402
from ceph_iscsi_config.utils import valid_ip from ceph_iscsi_config.utils import valid_ip # noqa E402
# the main function is called ansible_main to allow the call stack # the main function is called ansible_main to allow the call stack
@ -82,7 +82,7 @@ def ansible_main():
} }
} }
module = AnsibleModule(argument_spec=fields, module = AnsibleModule(argument_spec=fields, # noqa F405
supports_check_mode=False) supports_check_mode=False)
gateway_iqn = module.params['gateway_iqn'] gateway_iqn = module.params['gateway_iqn']
@ -110,7 +110,6 @@ def ansible_main():
module.fail_json(msg="iSCSI gateway creation/load failure " module.fail_json(msg="iSCSI gateway creation/load failure "
"({})".format(gateway.error_msg)) "({})".format(gateway.error_msg))
logger.info("END - GATEWAY configuration complete") logger.info("END - GATEWAY configuration complete")
module.exit_json(changed=gateway.changes_made, module.exit_json(changed=gateway.changes_made,
meta={"msg": "Gateway setup complete"}) meta={"msg": "Gateway setup complete"})

View File

@ -8,11 +8,11 @@ module: igw_lun
short_description: Manage ceph rbd images to present as iscsi LUNs to clients short_description: Manage ceph rbd images to present as iscsi LUNs to clients
description: description:
- This module calls the 'lun' configuration management module installed - 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 of rbd images, and then maps these rbd devices to the gateway node(s) to be
exposed through the kernel's LIO target. 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). on the target machine(s).
option: option:
@ -69,19 +69,21 @@ author:
- 'Paul Cuzner' - 'Paul Cuzner'
""" """
import os import os # noqa E402
import logging import logging # noqa E402
from logging.handlers import RotatingFileHandler 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.lun import LUN # noqa E402
from ceph_iscsi_config.utils import valid_size from ceph_iscsi_config.utils import valid_size # noqa E402
import ceph_iscsi_config.settings as settings import ceph_iscsi_config.settings as settings # noqa E402
# the main function is called ansible_main to allow the call stack # 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 # to be checked to determine whether the call to the ceph_iscsi_config
# modules is from ansible or not # modules is from ansible or not
def ansible_main(): def ansible_main():
# Define the fields needs to create/map rbd's the the host(s) # 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 # not supporting check mode currently
module = AnsibleModule(argument_spec=fields, module = AnsibleModule(argument_spec=fields, # noqa F405
supports_check_mode=False) supports_check_mode=False)
pool = module.params["pool"] pool = module.params["pool"]

View File

@ -53,13 +53,14 @@ author:
""" """
import os import os # noqa E402
import logging import logging # noqa E402
from logging.handlers import RotatingFileHandler 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.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 # 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 # to be checked to determine whether the call to the ceph_iscsi_config
@ -77,7 +78,7 @@ def ansible_main():
}, },
} }
module = AnsibleModule(argument_spec=fields, module = AnsibleModule(argument_spec=fields, # noqa F405
supports_check_mode=False) supports_check_mode=False)
client_iqn = module.params['client_iqn'] client_iqn = module.params['client_iqn']
@ -113,6 +114,7 @@ def ansible_main():
meta={"msg": "Client definition completed {} " meta={"msg": "Client definition completed {} "
"changes made".format(client.change_count)}) "changes made".format(client.change_count)})
if __name__ == '__main__': if __name__ == '__main__':
module_name = os.path.basename(__file__).replace('ansible_module_', '') module_name = os.path.basename(__file__).replace('ansible_module_', '')

View File

@ -56,16 +56,16 @@ author:
""" """
import os import os # noqa E402
import logging import logging # noqa E402
from logging.handlers import RotatingFileHandler from logging.handlers import RotatingFileHandler # noqa E402
from ansible.module_utils.basic import * 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.gateway import GWTarget # noqa E402
from ceph_iscsi_config.utils import valid_ip from ceph_iscsi_config.utils import valid_ip # noqa E402
# the main function is called ansible_main to allow the call stack # the main function is called ansible_main to allow the call stack
@ -82,7 +82,7 @@ def ansible_main():
} }
} }
module = AnsibleModule(argument_spec=fields, module = AnsibleModule(argument_spec=fields, # noqa F405
supports_check_mode=False) supports_check_mode=False)
gateway_iqn = module.params['gateway_iqn'] gateway_iqn = module.params['gateway_iqn']
@ -110,7 +110,6 @@ def ansible_main():
module.fail_json(msg="iSCSI gateway creation/load failure " module.fail_json(msg="iSCSI gateway creation/load failure "
"({})".format(gateway.error_msg)) "({})".format(gateway.error_msg))
logger.info("END - GATEWAY configuration complete") logger.info("END - GATEWAY configuration complete")
module.exit_json(changed=gateway.changes_made, module.exit_json(changed=gateway.changes_made,
meta={"msg": "Gateway setup complete"}) meta={"msg": "Gateway setup complete"})

View File

@ -8,11 +8,11 @@ module: igw_lun
short_description: Manage ceph rbd images to present as iscsi LUNs to clients short_description: Manage ceph rbd images to present as iscsi LUNs to clients
description: description:
- This module calls the 'lun' configuration management module installed - 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 of rbd images, and then maps these rbd devices to the gateway node(s) to be
exposed through the kernel's LIO target. 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). on the target machine(s).
option: option:
@ -69,19 +69,21 @@ author:
- 'Paul Cuzner' - 'Paul Cuzner'
""" """
import os import os # noqa E402
import logging import logging # noqa E402
from logging.handlers import RotatingFileHandler 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.lun import LUN # noqa E402
from ceph_iscsi_config.utils import valid_size from ceph_iscsi_config.utils import valid_size # noqa E402
import ceph_iscsi_config.settings as settings import ceph_iscsi_config.settings as settings # noqa E402
# the main function is called ansible_main to allow the call stack # 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 # to be checked to determine whether the call to the ceph_iscsi_config
# modules is from ansible or not # modules is from ansible or not
def ansible_main(): def ansible_main():
# Define the fields needs to create/map rbd's the the host(s) # 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 # not supporting check mode currently
module = AnsibleModule(argument_spec=fields, module = AnsibleModule(argument_spec=fields, # noqa F405
supports_check_mode=False) supports_check_mode=False)
pool = module.params["pool"] pool = module.params["pool"]