diff --git a/docker/kolla-toolbox/find_disks.py b/docker/kolla-toolbox/find_disks.py index 5b33882e22..f8175eae05 100644 --- a/docker/kolla-toolbox/find_disks.py +++ b/docker/kolla-toolbox/find_disks.py @@ -17,6 +17,13 @@ # This module has been relicensed from the source below: # https://github.com/SamYaple/yaodu/blob/master/ansible/library/ceph_osd_list +import json +import pyudev +import re +import subprocess # nosec + +from ansible.module_utils.basic import AnsibleModule + DOCUMENTATION = ''' --- module: find_disks @@ -74,11 +81,6 @@ EXAMPLES = ''' register: swift_disks ''' -import json -import pyudev -import re -import subprocess # nosec - PREFERRED_DEVICE_LINK_ORDER = [ '/dev/disk/by-uuid', @@ -354,7 +356,6 @@ def main(): except Exception as e: module.exit_json(failed=True, msg=repr(e)) -# import module snippets -from ansible.module_utils.basic import * # noqa + if __name__ == '__main__': main() diff --git a/docker/kolla-toolbox/kolla_keystone_service.py b/docker/kolla-toolbox/kolla_keystone_service.py index ca747e71e4..866350821e 100644 --- a/docker/kolla-toolbox/kolla_keystone_service.py +++ b/docker/kolla-toolbox/kolla_keystone_service.py @@ -26,6 +26,9 @@ import traceback import shade +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.openstack import openstack_full_argument_spec + def main(): argument_spec = openstack_full_argument_spec( @@ -94,8 +97,6 @@ def main(): module.exit_json(failed=True, changed=True, msg=repr(traceback.format_exc())) -# import module snippets -from ansible.module_utils.basic import * # noqa -from ansible.module_utils.openstack import * # noqa + if __name__ == '__main__': main() diff --git a/docker/kolla-toolbox/kolla_keystone_user.py b/docker/kolla-toolbox/kolla_keystone_user.py index 319cf67c82..af7d0d6ecb 100644 --- a/docker/kolla-toolbox/kolla_keystone_user.py +++ b/docker/kolla-toolbox/kolla_keystone_user.py @@ -18,6 +18,9 @@ import traceback import shade +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.openstack import openstack_full_argument_spec + def main(): argument_spec = openstack_full_argument_spec( @@ -83,8 +86,6 @@ def main(): module.exit_json(failed=True, changed=True, msg=repr(traceback.format_exc())) -# import module snippets -from ansible.module_utils.basic import * # noqa -from ansible.module_utils.openstack import * # noqa + if __name__ == '__main__': main() diff --git a/docker/kolla-toolbox/kolla_sanity.py b/docker/kolla-toolbox/kolla_sanity.py index 3df8d2ac2f..4de0026b8b 100644 --- a/docker/kolla-toolbox/kolla_sanity.py +++ b/docker/kolla-toolbox/kolla_sanity.py @@ -26,6 +26,9 @@ import traceback import shade +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.openstack import openstack_full_argument_spec + class SanityChecks(object): # TODO(pbourke): remove and replace with direct call to os_object @@ -56,8 +59,6 @@ def main(): module.exit_json(failed=True, changed=True, msg=repr(traceback.format_exc())) -# import module snippets -from ansible.module_utils.basic import * # noqa -from ansible.module_utils.openstack import * # noqa + if __name__ == '__main__': main() diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py index 69e1138e91..25facd19d7 100755 --- a/kolla/cmd/build.py +++ b/kolla/cmd/build.py @@ -15,6 +15,7 @@ import os import sys + # NOTE(SamYaple): Update the search path to prefer PROJECT_ROOT as the source # of packages to import if we are using local tools instead of # pip installed kolla tools @@ -23,7 +24,7 @@ PROJECT_ROOT = os.path.abspath(os.path.join( if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) -from kolla.image import build +from kolla.image import build # noqa def main(): diff --git a/kolla/image/build.py b/kolla/image/build.py index d11b098b71..9ab3f68df1 100755 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -46,13 +46,13 @@ PROJECT_ROOT = os.path.abspath(os.path.join( if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) -from kolla.common import config as common_config -from kolla.common import task -from kolla.common import utils -from kolla import exception -from kolla.template import filters as jinja_filters -from kolla.template import methods as jinja_methods -from kolla import version +from kolla.common import config as common_config # noqa +from kolla.common import task # noqa +from kolla.common import utils # noqa +from kolla import exception # noqa +from kolla.template import filters as jinja_filters # noqa +from kolla.template import methods as jinja_methods # noqa +from kolla import version # noqa LOG = utils.make_a_logger() diff --git a/test-requirements.txt b/test-requirements.txt index 9c57027b1f..9cb7d7189d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,7 +8,7 @@ coverage!=4.4,>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT extras>=1.0.0 # MIT graphviz!=0.5.0,>=0.4 # MIT License -hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +hacking>=1.1.0,<1.2.0 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 PrettyTable<0.8,>=0.7.1 # BSD diff --git a/tests/test_build.py b/tests/test_build.py index 379237daf9..d32188b55d 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -20,9 +20,10 @@ from oslo_log import log as logging from oslotest import base import testtools + sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), '../tools'))) -from kolla.image import build +from kolla.image import build # noqa LOG = logging.getLogger(__name__) diff --git a/tools/version-check.py b/tools/version-check.py index ce6d1ff725..3bdb0ad29e 100755 --- a/tools/version-check.py +++ b/tools/version-check.py @@ -30,8 +30,7 @@ PROJECT_ROOT = os.path.abspath(os.path.join( if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) - -from kolla.common import config +from kolla.common import config # noqa logging.basicConfig(level=logging.INFO)