From 3f10f70840f6c04fd9427eefcea838b5bf3d5d07 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 26 Nov 2019 10:31:00 +0000 Subject: [PATCH] Drop python 2 support from action plugins These are executed on the local host where we run ansible-playbook, and we have agreed to drop Python 2 support there. Partially Implements: blueprint drop-py2-support Change-Id: Id2190c3a22a56f4f048afbf0f7200daa8f41a292 --- ansible/action_plugins/merge_configs.py | 4 ++-- ansible/action_plugins/merge_yaml.py | 3 +-- requirements.txt | 1 - tests/test_merge_config.py | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ansible/action_plugins/merge_configs.py b/ansible/action_plugins/merge_configs.py index d2c0684bfc..54463e6537 100644 --- a/ansible/action_plugins/merge_configs.py +++ b/ansible/action_plugins/merge_configs.py @@ -22,7 +22,7 @@ import tempfile from ansible import constants from ansible.plugins import action -from six import StringIO +from io import StringIO from oslo_config import iniparser @@ -112,7 +112,7 @@ class OverrideConfigParser(iniparser.BaseParser): if index == 0: fp.write('{} = {}\n'.format(key, value)) else: - fp.write('{} {}\n'.format(len(key)*' ', value)) + fp.write('{} {}\n'.format(len(key) * ' ', value)) def write_section(section): for key, values in section.items(): diff --git a/ansible/action_plugins/merge_yaml.py b/ansible/action_plugins/merge_yaml.py index aa7e9499b1..28f194a5df 100755 --- a/ansible/action_plugins/merge_yaml.py +++ b/ansible/action_plugins/merge_yaml.py @@ -31,7 +31,6 @@ except ImportError: from ansible import constants from ansible.plugins import action -import six DOCUMENTATION = ''' --- @@ -149,7 +148,7 @@ class ActionModule(action.ActionBase): class Utils(object): @staticmethod def update_nested_conf(conf, update): - for k, v in six.iteritems(update): + for k, v in update.items(): if isinstance(v, dict): conf[k] = Utils.update_nested_conf(conf.get(k, {}), v) else: diff --git a/requirements.txt b/requirements.txt index 0bf32bc9d6..66c6cd386d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,6 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0 docker>=2.4.2 # Apache-2.0 Jinja2>=2.10 # BSD License (3 clause) -six>=1.10.0 # MIT oslo.config>=5.2.0 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0 setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,>=21.0.0 # PSF/ZPL diff --git a/tests/test_merge_config.py b/tests/test_merge_config.py index 21a4a0f576..8091025d18 100644 --- a/tests/test_merge_config.py +++ b/tests/test_merge_config.py @@ -17,9 +17,9 @@ import imp import os import sys +from io import StringIO import mock from oslotest import base -from six import StringIO PROJECT_DIR = os.path.abspath(os.path.join(os. path.dirname(__file__), '../'))