ansible-core - Remove support for Python 2.6. (#75853)

pull/75861/head
Matt Clay 3 years ago committed by GitHub
parent 099d80829f
commit 1932f0008b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
deprecated_features:
- ansible-core - Remove support for Python 2.6.

@ -1,2 +1,2 @@
major_changes:
deprecated_features:
- ansible-test - Remove support for Python 2.6.

@ -13,7 +13,7 @@ from ansible.module_utils.common._utils import get_all_subclasses
def get_all_pkg_managers():
return dict([(obj.__name__.lower(), obj) for obj in get_all_subclasses(PkgMgr) if obj not in (CLIMgr, LibMgr)])
return {obj.__name__.lower(): obj for obj in get_all_subclasses(PkgMgr) if obj not in (CLIMgr, LibMgr)}
class PkgMgr(with_metaclass(ABCMeta, object)):

@ -158,7 +158,7 @@ def main():
data['finished'] = 0
# Fix error: TypeError: exit_json() keywords must be strings
data = dict([(to_native(k), v) for k, v in iteritems(data)])
data = {to_native(k): v for k, v in iteritems(data)}
module.exit_json(**data)

@ -776,7 +776,7 @@ class YumModule(YumDnf):
rc2, out2, err2 = self.module.run_command(cmd)
if rc == 0 and rc2 == 0:
out += out2
pkgs = set([p for p in out.split('\n') if p.strip()])
pkgs = {p for p in out.split('\n') if p.strip()}
if not pkgs:
pkgs = self.is_installed(repoq, req_spec, qf=qf)
return pkgs

@ -30,7 +30,7 @@ class ActionModule(ActionBase):
TRANSFERS_FILES = False
BUILTIN_PKG_MGR_MODULES = set([manager['name'] for manager in PKG_MGRS])
BUILTIN_PKG_MGR_MODULES = {manager['name'] for manager in PKG_MGRS}
def run(self, tmp=None, task_vars=None):
''' handler for package operations '''

@ -828,8 +828,7 @@ if ($bytes_read -gt 0) {
supported_args = []
for auth_kwarg in AUTH_KWARGS.values():
supported_args.extend(auth_kwarg)
extra_args = set([v.replace('ansible_psrp_', '') for v in
self.get_option('_extras')])
extra_args = {v.replace('ansible_psrp_', '') for v in self.get_option('_extras')}
unsupported_args = extra_args.difference(supported_args)
for arg in unsupported_args:

@ -292,13 +292,13 @@ class Connection(ConnectionBase):
self._kerb_managed = False
# arg names we're going passing directly
internal_kwarg_mask = set(['self', 'endpoint', 'transport', 'username', 'password', 'scheme', 'path', 'kinit_mode', 'kinit_cmd'])
internal_kwarg_mask = {'self', 'endpoint', 'transport', 'username', 'password', 'scheme', 'path', 'kinit_mode', 'kinit_cmd'}
self._winrm_kwargs = dict(username=self._winrm_user, password=self._winrm_pass)
argspec = getargspec(Protocol.__init__)
supported_winrm_args = set(argspec.args)
supported_winrm_args.update(internal_kwarg_mask)
passed_winrm_args = set([v.replace('ansible_winrm_', '') for v in self.get_option('_extras')])
passed_winrm_args = {v.replace('ansible_winrm_', '') for v in self.get_option('_extras')}
unsupported_args = passed_winrm_args.difference(supported_winrm_args)
# warn for kwargs unsupported by the installed version of pywinrm

@ -225,7 +225,7 @@ class Display(with_metaclass(Singleton, object)):
try:
cmd = subprocess.Popen([self.b_cowsay, "-l"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(out, err) = cmd.communicate()
self.cows_available = set([to_text(c) for c in out.split()])
self.cows_available = {to_text(c) for c in out.split()}
if C.ANSIBLE_COW_ACCEPTLIST and any(C.ANSIBLE_COW_ACCEPTLIST):
self.cows_available = set(C.ANSIBLE_COW_ACCEPTLIST).intersection(self.cows_available)
except Exception:

@ -462,7 +462,7 @@ class VariableManager:
if play:
# This is a list of all role names of all dependencies for all roles for this play
dependency_role_names = list(set([d.get_name() for r in play.roles for d in r.get_all_dependencies()]))
dependency_role_names = list({d.get_name() for r in play.roles for d in r.get_all_dependencies()})
# This is a list of all role names of all roles for this play
play_role_names = [r.get_name() for r in play.roles]

@ -18,12 +18,10 @@ disable=
comparison-with-callable,
consider-iterating-dictionary,
consider-merging-isinstance,
consider-using-dict-comprehension, # requires Python 2.7+, but we still require Python 2.6 support
consider-using-dict-items,
consider-using-enumerate,
consider-using-get,
consider-using-in,
consider-using-set-comprehension, # requires Python 2.7+, but we still require Python 2.6 support
consider-using-ternary,
consider-using-with,
cyclic-import, # consistent results require running with --jobs 1 and testing all files

@ -119,7 +119,7 @@ def get_ps_argument_spec(filename, collection):
util_manifest = json.dumps({
'module_path': to_text(module_path, errors='surrogiate_or_strict'),
'ansible_basic': ps_dep_finder.cs_utils_module["Ansible.Basic"]['path'],
'ps_utils': dict([(name, info['path']) for name, info in ps_dep_finder.ps_modules.items()]),
'ps_utils': {name: info['path'] for name, info in ps_dep_finder.ps_modules.items()}
})
script_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ps_argspec.ps1')

@ -187,6 +187,7 @@ test/support/integration/plugins/inventory/aws_ec2.py pylint:use-a-generator
test/support/integration/plugins/modules/ec2_group.py pylint:use-a-generator
test/support/integration/plugins/modules/lvg.py pylint:disallowed-name
test/support/integration/plugins/modules/timezone.py pylint:disallowed-name
test/support/integration/plugins/modules/x509_crl.py pylint:consider-using-set-comprehension
test/support/integration/plugins/module_utils/aws/core.py pylint:property-with-parameters
test/support/integration/plugins/module_utils/cloud.py future-import-boilerplate
test/support/integration/plugins/module_utils/cloud.py metaclass-boilerplate
@ -203,6 +204,7 @@ test/support/integration/plugins/module_utils/network/common/utils.py metaclass-
test/support/integration/plugins/module_utils/network/common/utils.py pylint:use-a-generator
test/support/integration/plugins/module_utils/postgres.py future-import-boilerplate
test/support/integration/plugins/module_utils/postgres.py metaclass-boilerplate
test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/filter/network.py pylint:consider-using-dict-comprehension
test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/compat/ipaddress.py no-unicode-literals
test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/compat/ipaddress.py pep8:E203
test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py pylint:unnecessary-comprehension

Loading…
Cancel
Save