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 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
@ -77,7 +78,7 @@ def ansible_main():
},
}
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_', '')

View 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
@ -82,7 +82,7 @@ def ansible_main():
}
}
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"})

View 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"]

View 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
@ -77,7 +78,7 @@ def ansible_main():
},
}
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_', '')

View 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
@ -82,7 +82,7 @@ def ansible_main():
}
}
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"})

View 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"]