From b41309ef16f0aa2c95ce0d36cbec7e3741fefdc7 Mon Sep 17 00:00:00 2001 From: confi-surya Date: Mon, 24 Dec 2018 12:48:56 +0530 Subject: [PATCH] Update hacking version Use latest release 1.1.0 and compatible changes w.r.t pep8 Change-Id: Ie5e5417a1d8481bb59d516a320bd7cc1dd89591e --- ansible/action_plugins/merge_configs.py | 28 ++++++++--------- ansible/action_plugins/merge_yaml.py | 38 ++++++++++++------------ ansible/library/bslurp.py | 16 +++++----- ansible/library/kolla_container_facts.py | 8 +++-- ansible/library/kolla_docker.py | 18 +++++------ ansible/library/kolla_toolbox.py | 12 ++++---- test-requirements.txt | 2 +- 7 files changed, 62 insertions(+), 60 deletions(-) diff --git a/ansible/action_plugins/merge_configs.py b/ansible/action_plugins/merge_configs.py index bc5df494eb..12b3234510 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 17ccd64e59..75f49d506a 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 b83603d295..5d38f64bc3 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 90816e2e25..0e0c9b4272 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 7705c8b9b3..1c8cc2bb8a 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 5a4702d688..85c9fb2457 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\w+) \| (?P\w+)!? =>(?P.*)$', re.MULTILINE | re.DOTALL) NON_JSON_REG = re.compile(('^(?P\w+) \| (?P\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 097f938977..799ae1eb4a 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