diff --git a/ansible/action_plugins/merge_configs.py b/ansible/action_plugins/merge_configs.py index bc5df494ebfea79ae9738c82bb3d1f9a81ba5a41..12b323451022e59646242c1c873dd4e869980691 100644 --- a/ansible/action_plugins/merge_configs.py +++ b/ansible/action_plugins/merge_configs.py @@ -15,6 +15,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import collections +import inspect +import os +import shutil +import tempfile + +from ansible import constants +from ansible.plugins import action +from six import StringIO + +from oslo_config import iniparser + +_ORPHAN_SECTION = 'TEMPORARY_ORPHAN_VARIABLE_SECTION' + DOCUMENTATION = ''' --- module: merge_configs @@ -51,20 +65,6 @@ Merge multiple configs: - "/etc/mysql/my.cnf" ''' -import collections -import inspect -import os -import shutil -import tempfile - -from ansible import constants -from ansible.plugins import action -from six import StringIO - -from oslo_config import iniparser - -_ORPHAN_SECTION = 'TEMPORARY_ORPHAN_VARIABLE_SECTION' - class OverrideConfigParser(iniparser.BaseParser): diff --git a/ansible/action_plugins/merge_yaml.py b/ansible/action_plugins/merge_yaml.py index 17ccd64e599facaccf31cd2768d4779a7bfde626..75f49d506a490e859bddcfbae4536f35049b8256 100755 --- a/ansible/action_plugins/merge_yaml.py +++ b/ansible/action_plugins/merge_yaml.py @@ -15,6 +15,25 @@ # See the License for the specific language governing permissions and # limitations under the License. +import inspect +import os +import shutil +import tempfile + +from yaml import dump +from yaml import safe_load +try: + from yaml import CDumper as Dumper # noqa: F401 + from yaml import CLoader as Loader # noqa: F401 +except ImportError: + from yaml import Dumper # noqa: F401 + from yaml import Loader # noqa: F401 + + +from ansible import constants +from ansible.plugins import action +import six + DOCUMENTATION = ''' --- module: merge_yaml @@ -50,25 +69,6 @@ Merge multiple yaml files: - "/tmp/out.yml" ''' -import inspect -import os -import shutil -import tempfile - -from yaml import dump -from yaml import safe_load -try: - from yaml import CDumper as Dumper # noqa: F401 - from yaml import CLoader as Loader # noqa: F401 -except ImportError: - from yaml import Dumper # noqa: F401 - from yaml import Loader # noqa: F401 - - -from ansible import constants -from ansible.plugins import action -import six - class ActionModule(action.ActionBase): diff --git a/ansible/library/bslurp.py b/ansible/library/bslurp.py index b83603d295e7f8fae233b81b578dea7f47a36ca8..5d38f64bc3d0dd138943e1000e8ab2b788c705cf 100644 --- a/ansible/library/bslurp.py +++ b/ansible/library/bslurp.py @@ -17,6 +17,14 @@ # This module has been relicensed from the source below: # https://github.com/SamYaple/yaodu/blob/master/ansible/library/bslurp +import base64 +import hashlib +import os +import traceback +import zlib + +from ansible.module_utils.basic import AnsibleModule + DOCUMENTATION = ''' --- module: bslurp @@ -107,12 +115,6 @@ permissions on dest: sha1: "{{ file_data.sha1 }}" ''' -import base64 -import hashlib -import os -import traceback -import zlib - def copy_from_host(module): compress = module.params.get('compress') @@ -187,7 +189,5 @@ def main(): msg=repr(traceback.format_exc())) -# import module snippets -from ansible.module_utils.basic import * # noqa if __name__ == '__main__': main() diff --git a/ansible/library/kolla_container_facts.py b/ansible/library/kolla_container_facts.py index 90816e2e252b2eb2a7f5ae9a9d4cb3eb6e03e03c..0e0c9b4272bae5a15092a8a9e12f4cc6292b1f60 100644 --- a/ansible/library/kolla_container_facts.py +++ b/ansible/library/kolla_container_facts.py @@ -14,6 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. + +import docker + +from ansible.module_utils.basic import AnsibleModule + DOCUMENTATION = ''' --- module: kolla_container_facts @@ -49,8 +54,6 @@ EXAMPLES = ''' - glance_registry ''' -import docker - def get_docker_client(): return docker.APIClient @@ -81,6 +84,5 @@ def main(): module.exit_json(**results) -from ansible.module_utils.basic import * # noqa if __name__ == "__main__": main() diff --git a/ansible/library/kolla_docker.py b/ansible/library/kolla_docker.py index 7705c8b9b3bf3153820d10bd855e858f7c690b6c..1c8cc2bb8ad252b5fd5d999acb7e57ff7470f33f 100644 --- a/ansible/library/kolla_docker.py +++ b/ansible/library/kolla_docker.py @@ -14,6 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json +import os +import shlex +import traceback + +import docker + +from ansible.module_utils.basic import AnsibleModule + DOCUMENTATION = ''' --- module: kolla_docker @@ -217,13 +226,6 @@ EXAMPLES = ''' image: name_of_image ''' -import json -import os -import shlex -import traceback - -import docker - def get_docker_client(): return docker.APIClient @@ -938,7 +940,5 @@ def main(): module.fail_json(changed=True, msg=repr(traceback.format_exc()), **dw.result) -# import module snippets -from ansible.module_utils.basic import * # noqa if __name__ == '__main__': main() diff --git a/ansible/library/kolla_toolbox.py b/ansible/library/kolla_toolbox.py index 5a4702d6881c318ce18b2cebdfb25b804c8ba111..85c9fb24572f0f24267de3b97a9255d36dff67a2 100644 --- a/ansible/library/kolla_toolbox.py +++ b/ansible/library/kolla_toolbox.py @@ -14,6 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +import docker +import json +import re + +from ansible.module_utils.basic import AnsibleModule + DOCUMENTATION = ''' --- module: kolla_toolbox @@ -84,11 +90,6 @@ EXAMPLES = ''' ''' -import docker -import json -import re - - JSON_REG = re.compile('^(?P<host>\w+) \| (?P<status>\w+)!? =>(?P<stdout>.*)$', re.MULTILINE | re.DOTALL) NON_JSON_REG = re.compile(('^(?P<host>\w+) \| (?P<status>\w+)!? \| ' @@ -158,6 +159,5 @@ def main(): module.exit_json(**ret) -from ansible.module_utils.basic import * # noqa if __name__ == "__main__": main() diff --git a/test-requirements.txt b/test-requirements.txt index 097f938977b5b22257cc4a4d1e51df291b5a9179..799ae1eb4afe42cf4efc3e507728ec0b82a93afe 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -7,7 +7,7 @@ beautifulsoup4>=4.6.0 # MIT coverage!=4.4,>=4.0 # Apache-2.0 doc8>=0.6.0 # Apache-2.0 extras>=1.0.0 # MIT -hacking>=0.10.0,<1.1.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