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
This commit is contained in:
Mark Goddard 2019-11-26 10:31:00 +00:00
parent 5405cfecb9
commit 3f10f70840
4 changed files with 4 additions and 6 deletions

View File

@ -22,7 +22,7 @@ import tempfile
from ansible import constants from ansible import constants
from ansible.plugins import action from ansible.plugins import action
from six import StringIO from io import StringIO
from oslo_config import iniparser from oslo_config import iniparser
@ -112,7 +112,7 @@ class OverrideConfigParser(iniparser.BaseParser):
if index == 0: if index == 0:
fp.write('{} = {}\n'.format(key, value)) fp.write('{} = {}\n'.format(key, value))
else: else:
fp.write('{} {}\n'.format(len(key)*' ', value)) fp.write('{} {}\n'.format(len(key) * ' ', value))
def write_section(section): def write_section(section):
for key, values in section.items(): for key, values in section.items():

View File

@ -31,7 +31,6 @@ except ImportError:
from ansible import constants from ansible import constants
from ansible.plugins import action from ansible.plugins import action
import six
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
@ -149,7 +148,7 @@ class ActionModule(action.ActionBase):
class Utils(object): class Utils(object):
@staticmethod @staticmethod
def update_nested_conf(conf, update): def update_nested_conf(conf, update):
for k, v in six.iteritems(update): for k, v in update.items():
if isinstance(v, dict): if isinstance(v, dict):
conf[k] = Utils.update_nested_conf(conf.get(k, {}), v) conf[k] = Utils.update_nested_conf(conf.get(k, {}), v)
else: else:

View File

@ -4,7 +4,6 @@
pbr!=2.1.0,>=2.0.0 # Apache-2.0 pbr!=2.1.0,>=2.0.0 # Apache-2.0
docker>=2.4.2 # Apache-2.0 docker>=2.4.2 # Apache-2.0
Jinja2>=2.10 # BSD License (3 clause) Jinja2>=2.10 # BSD License (3 clause)
six>=1.10.0 # MIT
oslo.config>=5.2.0 # Apache-2.0 oslo.config>=5.2.0 # Apache-2.0
oslo.utils>=3.33.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 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

View File

@ -17,9 +17,9 @@ import imp
import os import os
import sys import sys
from io import StringIO
import mock import mock
from oslotest import base from oslotest import base
from six import StringIO
PROJECT_DIR = os.path.abspath(os.path.join(os. path.dirname(__file__), '../')) PROJECT_DIR = os.path.abspath(os.path.join(os. path.dirname(__file__), '../'))