diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 16:16:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 16:16:49 +0000 |
commit | 48e387c5c12026a567eb7b293a3a590241c0cecb (patch) | |
tree | 80f2573be2d7d534b8ac4d2a852fe43f7ac35324 /test/support | |
parent | Releasing progress-linux version 2.16.6-1~progress7.99u1. (diff) | |
download | ansible-core-48e387c5c12026a567eb7b293a3a590241c0cecb.tar.xz ansible-core-48e387c5c12026a567eb7b293a3a590241c0cecb.zip |
Merging upstream version 2.17.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/support')
65 files changed, 69 insertions, 1008 deletions
diff --git a/test/support/integration/plugins/filter/json_query.py b/test/support/integration/plugins/filter/json_query.py deleted file mode 100644 index d1da71b..0000000 --- a/test/support/integration/plugins/filter/json_query.py +++ /dev/null @@ -1,53 +0,0 @@ -# (c) 2015, Filipe Niero Felisbino <filipenf@gmail.com> -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see <http://www.gnu.org/licenses/>. - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible.errors import AnsibleError, AnsibleFilterError - -try: - import jmespath - HAS_LIB = True -except ImportError: - HAS_LIB = False - - -def json_query(data, expr): - '''Query data using jmespath query language ( http://jmespath.org ). Example: - - debug: msg="{{ instance | json_query(tagged_instances[*].block_device_mapping.*.volume_id') }}" - ''' - if not HAS_LIB: - raise AnsibleError('You need to install "jmespath" prior to running ' - 'json_query filter') - - try: - return jmespath.search(expr, data) - except jmespath.exceptions.JMESPathError as e: - raise AnsibleFilterError('JMESPathError in json_query filter plugin:\n%s' % e) - except Exception as e: - # For older jmespath, we can get ValueError and TypeError without much info. - raise AnsibleFilterError('Error in jmespath.search in json_query filter plugin:\n%s' % e) - - -class FilterModule(object): - ''' Query filter ''' - - def filters(self): - return { - 'json_query': json_query - } diff --git a/test/support/integration/plugins/modules/pkgng.py b/test/support/integration/plugins/modules/pkgng.py index 1136347..85c5636 100644 --- a/test/support/integration/plugins/modules/pkgng.py +++ b/test/support/integration/plugins/modules/pkgng.py @@ -9,8 +9,7 @@ # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function -__metaclass__ = type +from __future__ import annotations ANSIBLE_METADATA = {'metadata_version': '1.1', diff --git a/test/support/integration/plugins/modules/sefcontext.py b/test/support/integration/plugins/modules/sefcontext.py deleted file mode 100644 index 946ae88..0000000 --- a/test/support/integration/plugins/modules/sefcontext.py +++ /dev/null @@ -1,308 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: (c) 2016, Dag Wieers (@dagwieers) <dag@wieers.com> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} - -DOCUMENTATION = r''' ---- -module: sefcontext -short_description: Manages SELinux file context mapping definitions -description: -- Manages SELinux file context mapping definitions. -- Similar to the C(semanage fcontext) command. -version_added: '2.2' -options: - target: - description: - - Target path (expression). - type: str - required: yes - aliases: [ path ] - ftype: - description: - - The file type that should have SELinux contexts applied. - - "The following file type options are available:" - - C(a) for all files, - - C(b) for block devices, - - C(c) for character devices, - - C(d) for directories, - - C(f) for regular files, - - C(l) for symbolic links, - - C(p) for named pipes, - - C(s) for socket files. - type: str - choices: [ a, b, c, d, f, l, p, s ] - default: a - setype: - description: - - SELinux type for the specified target. - type: str - required: yes - seuser: - description: - - SELinux user for the specified target. - type: str - selevel: - description: - - SELinux range for the specified target. - type: str - aliases: [ serange ] - state: - description: - - Whether the SELinux file context must be C(absent) or C(present). - type: str - choices: [ absent, present ] - default: present - reload: - description: - - Reload SELinux policy after commit. - - Note that this does not apply SELinux file contexts to existing files. - type: bool - default: yes - ignore_selinux_state: - description: - - Useful for scenarios (chrooted environment) that you can't get the real SELinux state. - type: bool - default: no - version_added: '2.8' -notes: -- The changes are persistent across reboots. -- The M(sefcontext) module does not modify existing files to the new - SELinux context(s), so it is advisable to first create the SELinux - file contexts before creating files, or run C(restorecon) manually - for the existing files that require the new SELinux file contexts. -- Not applying SELinux fcontexts to existing files is a deliberate - decision as it would be unclear what reported changes would entail - to, and there's no guarantee that applying SELinux fcontext does - not pick up other unrelated prior changes. -requirements: -- libselinux-python -- policycoreutils-python -author: -- Dag Wieers (@dagwieers) -''' - -EXAMPLES = r''' -- name: Allow apache to modify files in /srv/git_repos - sefcontext: - target: '/srv/git_repos(/.*)?' - setype: httpd_git_rw_content_t - state: present - -- name: Apply new SELinux file context to filesystem - command: restorecon -irv /srv/git_repos -''' - -RETURN = r''' -# Default return values -''' - -import traceback - -from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.common.respawn import has_respawned, probe_interpreters_for_module, respawn_module -from ansible.module_utils.common.text.converters import to_native - -SELINUX_IMP_ERR = None -try: - import selinux - HAVE_SELINUX = True -except ImportError: - SELINUX_IMP_ERR = traceback.format_exc() - HAVE_SELINUX = False - -SEOBJECT_IMP_ERR = None -try: - import seobject - HAVE_SEOBJECT = True -except ImportError: - SEOBJECT_IMP_ERR = traceback.format_exc() - HAVE_SEOBJECT = False - -# Add missing entries (backward compatible) -if HAVE_SEOBJECT: - seobject.file_types.update( - a=seobject.SEMANAGE_FCONTEXT_ALL, - b=seobject.SEMANAGE_FCONTEXT_BLOCK, - c=seobject.SEMANAGE_FCONTEXT_CHAR, - d=seobject.SEMANAGE_FCONTEXT_DIR, - f=seobject.SEMANAGE_FCONTEXT_REG, - l=seobject.SEMANAGE_FCONTEXT_LINK, - p=seobject.SEMANAGE_FCONTEXT_PIPE, - s=seobject.SEMANAGE_FCONTEXT_SOCK, - ) - -# Make backward compatible -option_to_file_type_str = dict( - a='all files', - b='block device', - c='character device', - d='directory', - f='regular file', - l='symbolic link', - p='named pipe', - s='socket', -) - - -def get_runtime_status(ignore_selinux_state=False): - return True if ignore_selinux_state is True else selinux.is_selinux_enabled() - - -def semanage_fcontext_exists(sefcontext, target, ftype): - ''' Get the SELinux file context mapping definition from policy. Return None if it does not exist. ''' - - # Beware that records comprise of a string representation of the file_type - record = (target, option_to_file_type_str[ftype]) - records = sefcontext.get_all() - try: - return records[record] - except KeyError: - return None - - -def semanage_fcontext_modify(module, result, target, ftype, setype, do_reload, serange, seuser, sestore=''): - ''' Add or modify SELinux file context mapping definition to the policy. ''' - - changed = False - prepared_diff = '' - - try: - sefcontext = seobject.fcontextRecords(sestore) - sefcontext.set_reload(do_reload) - exists = semanage_fcontext_exists(sefcontext, target, ftype) - if exists: - # Modify existing entry - orig_seuser, orig_serole, orig_setype, orig_serange = exists - - if seuser is None: - seuser = orig_seuser - if serange is None: - serange = orig_serange - - if setype != orig_setype or seuser != orig_seuser or serange != orig_serange: - if not module.check_mode: - sefcontext.modify(target, setype, ftype, serange, seuser) - changed = True - - if module._diff: - prepared_diff += '# Change to semanage file context mappings\n' - prepared_diff += '-%s %s %s:%s:%s:%s\n' % (target, ftype, orig_seuser, orig_serole, orig_setype, orig_serange) - prepared_diff += '+%s %s %s:%s:%s:%s\n' % (target, ftype, seuser, orig_serole, setype, serange) - else: - # Add missing entry - if seuser is None: - seuser = 'system_u' - if serange is None: - serange = 's0' - - if not module.check_mode: - sefcontext.add(target, setype, ftype, serange, seuser) - changed = True - - if module._diff: - prepared_diff += '# Addition to semanage file context mappings\n' - prepared_diff += '+%s %s %s:%s:%s:%s\n' % (target, ftype, seuser, 'object_r', setype, serange) - - except Exception as e: - module.fail_json(msg="%s: %s\n" % (e.__class__.__name__, to_native(e))) - - if module._diff and prepared_diff: - result['diff'] = dict(prepared=prepared_diff) - - module.exit_json(changed=changed, seuser=seuser, serange=serange, **result) - - -def semanage_fcontext_delete(module, result, target, ftype, do_reload, sestore=''): - ''' Delete SELinux file context mapping definition from the policy. ''' - - changed = False - prepared_diff = '' - - try: - sefcontext = seobject.fcontextRecords(sestore) - sefcontext.set_reload(do_reload) - exists = semanage_fcontext_exists(sefcontext, target, ftype) - if exists: - # Remove existing entry - orig_seuser, orig_serole, orig_setype, orig_serange = exists - - if not module.check_mode: - sefcontext.delete(target, ftype) - changed = True - - if module._diff: - prepared_diff += '# Deletion to semanage file context mappings\n' - prepared_diff += '-%s %s %s:%s:%s:%s\n' % (target, ftype, exists[0], exists[1], exists[2], exists[3]) - - except Exception as e: - module.fail_json(msg="%s: %s\n" % (e.__class__.__name__, to_native(e))) - - if module._diff and prepared_diff: - result['diff'] = dict(prepared=prepared_diff) - - module.exit_json(changed=changed, **result) - - -def main(): - module = AnsibleModule( - argument_spec=dict( - ignore_selinux_state=dict(type='bool', default=False), - target=dict(type='str', required=True, aliases=['path']), - ftype=dict(type='str', default='a', choices=option_to_file_type_str.keys()), - setype=dict(type='str', required=True), - seuser=dict(type='str'), - selevel=dict(type='str', aliases=['serange']), - state=dict(type='str', default='present', choices=['absent', 'present']), - reload=dict(type='bool', default=True), - ), - supports_check_mode=True, - ) - - if not HAVE_SELINUX or not HAVE_SEOBJECT and not has_respawned(): - system_interpreters = [ - '/usr/libexec/platform-python', - '/usr/bin/python3', - '/usr/bin/python2', - ] - # policycoreutils-python depends on libselinux-python - interpreter = probe_interpreters_for_module(system_interpreters, 'seobject') - if interpreter: - respawn_module(interpreter) - - if not HAVE_SELINUX or not HAVE_SEOBJECT: - module.fail_json(msg=missing_required_lib("policycoreutils-python(3)"), exception=SELINUX_IMP_ERR) - - ignore_selinux_state = module.params['ignore_selinux_state'] - - if not get_runtime_status(ignore_selinux_state): - module.fail_json(msg="SELinux is disabled on this host.") - - target = module.params['target'] - ftype = module.params['ftype'] - setype = module.params['setype'] - seuser = module.params['seuser'] - serange = module.params['selevel'] - state = module.params['state'] - do_reload = module.params['reload'] - - result = dict(target=target, ftype=ftype, setype=setype, state=state) - - if state == 'present': - semanage_fcontext_modify(module, result, target, ftype, setype, do_reload, serange, seuser) - elif state == 'absent': - semanage_fcontext_delete(module, result, target, ftype, do_reload) - else: - module.fail_json(msg='Invalid value of argument "state": {0}'.format(state)) - - -if __name__ == '__main__': - main() diff --git a/test/support/integration/plugins/modules/timezone.py b/test/support/integration/plugins/modules/timezone.py index dd37483..9da4038 100644 --- a/test/support/integration/plugins/modules/timezone.py +++ b/test/support/integration/plugins/modules/timezone.py @@ -4,8 +4,7 @@ # Copyright: (c) 2016, Shinichi TAMURA (@tmshn) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function -__metaclass__ = type +from __future__ import annotations ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], diff --git a/test/support/integration/plugins/modules/zypper.py b/test/support/integration/plugins/modules/zypper.py deleted file mode 100644 index cd67b60..0000000 --- a/test/support/integration/plugins/modules/zypper.py +++ /dev/null @@ -1,539 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# (c) 2013, Patrick Callahan <pmc@patrickcallahan.com> -# based on -# openbsd_pkg -# (c) 2013 -# Patrik Lundin <patrik.lundin.swe@gmail.com> -# -# yum -# (c) 2012, Red Hat, Inc -# Written by Seth Vidal <skvidal at fedoraproject.org> -# -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community'} - - -DOCUMENTATION = ''' ---- -module: zypper -author: - - "Patrick Callahan (@dirtyharrycallahan)" - - "Alexander Gubin (@alxgu)" - - "Thomas O'Donnell (@andytom)" - - "Robin Roth (@robinro)" - - "Andrii Radyk (@AnderEnder)" -version_added: "1.2" -short_description: Manage packages on SUSE and openSUSE -description: - - Manage packages on SUSE and openSUSE using the zypper and rpm tools. -options: - name: - description: - - Package name C(name) or package specifier or a list of either. - - Can include a version like C(name=1.0), C(name>3.4) or C(name<=2.7). If a version is given, C(oldpackage) is implied and zypper is allowed to - update the package within the version range given. - - You can also pass a url or a local path to an rpm file. - - When using state=latest, this can be '*', which updates all installed packages. - required: true - aliases: [ 'pkg' ] - state: - description: - - C(present) will make sure the package is installed. - C(latest) will make sure the latest version of the package is installed. - C(absent) will make sure the specified package is not installed. - C(dist-upgrade) will make sure the latest version of all installed packages from all enabled repositories is installed. - - When using C(dist-upgrade), I(name) should be C('*'). - required: false - choices: [ present, latest, absent, dist-upgrade ] - default: "present" - type: - description: - - The type of package to be operated on. - required: false - choices: [ package, patch, pattern, product, srcpackage, application ] - default: "package" - version_added: "2.0" - extra_args_precommand: - version_added: "2.6" - required: false - description: - - Add additional global target options to C(zypper). - - Options should be supplied in a single line as if given in the command line. - disable_gpg_check: - description: - - Whether to disable to GPG signature checking of the package - signature being installed. Has an effect only if state is - I(present) or I(latest). - required: false - default: "no" - type: bool - disable_recommends: - version_added: "1.8" - description: - - Corresponds to the C(--no-recommends) option for I(zypper). Default behavior (C(yes)) modifies zypper's default behavior; C(no) does - install recommended packages. - required: false - default: "yes" - type: bool - force: - version_added: "2.2" - description: - - Adds C(--force) option to I(zypper). Allows to downgrade packages and change vendor or architecture. - required: false - default: "no" - type: bool - force_resolution: - version_added: "2.10" - description: - - Adds C(--force-resolution) option to I(zypper). Allows to (un)install packages with conflicting requirements (resolver will choose a solution). - required: false - default: "no" - type: bool - update_cache: - version_added: "2.2" - description: - - Run the equivalent of C(zypper refresh) before the operation. Disabled in check mode. - required: false - default: "no" - type: bool - aliases: [ "refresh" ] - oldpackage: - version_added: "2.2" - description: - - Adds C(--oldpackage) option to I(zypper). Allows to downgrade packages with less side-effects than force. This is implied as soon as a - version is specified as part of the package name. - required: false - default: "no" - type: bool - extra_args: - version_added: "2.4" - required: false - description: - - Add additional options to C(zypper) command. - - Options should be supplied in a single line as if given in the command line. -notes: - - When used with a `loop:` each package will be processed individually, - it is much more efficient to pass the list directly to the `name` option. -# informational: requirements for nodes -requirements: - - "zypper >= 1.0 # included in openSUSE >= 11.1 or SUSE Linux Enterprise Server/Desktop >= 11.0" - - python-xml - - rpm -''' - -EXAMPLES = ''' -# Install "nmap" -- zypper: - name: nmap - state: present - -# Install apache2 with recommended packages -- zypper: - name: apache2 - state: present - disable_recommends: no - -# Apply a given patch -- zypper: - name: openSUSE-2016-128 - state: present - type: patch - -# Remove the "nmap" package -- zypper: - name: nmap - state: absent - -# Install the nginx rpm from a remote repo -- zypper: - name: 'http://nginx.org/packages/sles/12/x86_64/RPMS/nginx-1.8.0-1.sles12.ngx.x86_64.rpm' - state: present - -# Install local rpm file -- zypper: - name: /tmp/fancy-software.rpm - state: present - -# Update all packages -- zypper: - name: '*' - state: latest - -# Apply all available patches -- zypper: - name: '*' - state: latest - type: patch - -# Perform a dist-upgrade with additional arguments -- zypper: - name: '*' - state: dist-upgrade - extra_args: '--no-allow-vendor-change --allow-arch-change' - -# Refresh repositories and update package "openssl" -- zypper: - name: openssl - state: present - update_cache: yes - -# Install specific version (possible comparisons: <, >, <=, >=, =) -- zypper: - name: 'docker>=1.10' - state: present - -# Wait 20 seconds to acquire the lock before failing -- zypper: - name: mosh - state: present - environment: - ZYPP_LOCK_TIMEOUT: 20 -''' - -import xml -import re -from xml.dom.minidom import parseString as parseXML -from ansible.module_utils.common.text.converters import to_native - -# import module snippets -from ansible.module_utils.basic import AnsibleModule - - -class Package: - def __init__(self, name, prefix, version): - self.name = name - self.prefix = prefix - self.version = version - self.shouldinstall = (prefix == '+') - - def __str__(self): - return self.prefix + self.name + self.version - - -def split_name_version(name): - """splits of the package name and desired version - - example formats: - - docker>=1.10 - - apache=2.4 - - Allowed version specifiers: <, >, <=, >=, = - Allowed version format: [0-9.-]* - - Also allows a prefix indicating remove "-", "~" or install "+" - """ - - prefix = '' - if name[0] in ['-', '~', '+']: - prefix = name[0] - name = name[1:] - if prefix == '~': - prefix = '-' - - version_check = re.compile('^(.*?)((?:<|>|<=|>=|=)[0-9.-]*)?$') - try: - reres = version_check.match(name) - name, version = reres.groups() - if version is None: - version = '' - return prefix, name, version - except Exception: - return prefix, name, '' - - -def get_want_state(names, remove=False): - packages = [] - urls = [] - for name in names: - if '://' in name or name.endswith('.rpm'): - urls.append(name) - else: - prefix, pname, version = split_name_version(name) - if prefix not in ['-', '+']: - if remove: - prefix = '-' - else: - prefix = '+' - packages.append(Package(pname, prefix, version)) - return packages, urls - - -def get_installed_state(m, packages): - "get installed state of packages" - - cmd = get_cmd(m, 'search') - cmd.extend(['--match-exact', '--details', '--installed-only']) - cmd.extend([p.name for p in packages]) - return parse_zypper_xml(m, cmd, fail_not_found=False)[0] - - -def parse_zypper_xml(m, cmd, fail_not_found=True, packages=None): - rc, stdout, stderr = m.run_command(cmd, check_rc=False) - - try: - dom = parseXML(stdout) - except xml.parsers.expat.ExpatError as exc: - m.fail_json(msg="Failed to parse zypper xml output: %s" % to_native(exc), - rc=rc, stdout=stdout, stderr=stderr, cmd=cmd) - - if rc == 104: - # exit code 104 is ZYPPER_EXIT_INF_CAP_NOT_FOUND (no packages found) - if fail_not_found: - errmsg = dom.getElementsByTagName('message')[-1].childNodes[0].data - m.fail_json(msg=errmsg, rc=rc, stdout=stdout, stderr=stderr, cmd=cmd) - else: - return {}, rc, stdout, stderr - elif rc in [0, 106, 103]: - # zypper exit codes - # 0: success - # 106: signature verification failed - # 103: zypper was upgraded, run same command again - if packages is None: - firstrun = True - packages = {} - solvable_list = dom.getElementsByTagName('solvable') - for solvable in solvable_list: - name = solvable.getAttribute('name') - packages[name] = {} - packages[name]['version'] = solvable.getAttribute('edition') - packages[name]['oldversion'] = solvable.getAttribute('edition-old') - status = solvable.getAttribute('status') - packages[name]['installed'] = status == "installed" - packages[name]['group'] = solvable.parentNode.nodeName - if rc == 103 and firstrun: - # if this was the first run and it failed with 103 - # run zypper again with the same command to complete update - return parse_zypper_xml(m, cmd, fail_not_found=fail_not_found, packages=packages) - - return packages, rc, stdout, stderr - m.fail_json(msg='Zypper run command failed with return code %s.' % rc, rc=rc, stdout=stdout, stderr=stderr, cmd=cmd) - - -def get_cmd(m, subcommand): - "puts together the basic zypper command arguments with those passed to the module" - is_install = subcommand in ['install', 'update', 'patch', 'dist-upgrade'] - is_refresh = subcommand == 'refresh' - cmd = ['/usr/bin/zypper', '--quiet', '--non-interactive', '--xmlout'] - if m.params['extra_args_precommand']: - args_list = m.params['extra_args_precommand'].split() - cmd.extend(args_list) - # add global options before zypper command - if (is_install or is_refresh) and m.params['disable_gpg_check']: - cmd.append('--no-gpg-checks') - - if subcommand == 'search': - cmd.append('--disable-repositories') - - cmd.append(subcommand) - if subcommand not in ['patch', 'dist-upgrade'] and not is_refresh: - cmd.extend(['--type', m.params['type']]) - if m.check_mode and subcommand != 'search': - cmd.append('--dry-run') - if is_install: - cmd.append('--auto-agree-with-licenses') - if m.params['disable_recommends']: - cmd.append('--no-recommends') - if m.params['force']: - cmd.append('--force') - if m.params['force_resolution']: - cmd.append('--force-resolution') - if m.params['oldpackage']: - cmd.append('--oldpackage') - if m.params['extra_args']: - args_list = m.params['extra_args'].split(' ') - cmd.extend(args_list) - - return cmd - - -def set_diff(m, retvals, result): - # TODO: if there is only one package, set before/after to version numbers - packages = {'installed': [], 'removed': [], 'upgraded': []} - if result: - for p in result: - group = result[p]['group'] - if group == 'to-upgrade': - versions = ' (' + result[p]['oldversion'] + ' => ' + result[p]['version'] + ')' - packages['upgraded'].append(p + versions) - elif group == 'to-install': - packages['installed'].append(p) - elif group == 'to-remove': - packages['removed'].append(p) - - output = '' - for state in packages: - if packages[state]: - output += state + ': ' + ', '.join(packages[state]) + '\n' - if 'diff' not in retvals: - retvals['diff'] = {} - if 'prepared' not in retvals['diff']: - retvals['diff']['prepared'] = output - else: - retvals['diff']['prepared'] += '\n' + output - - -def package_present(m, name, want_latest): - "install and update (if want_latest) the packages in name_install, while removing the packages in name_remove" - retvals = {'rc': 0, 'stdout': '', 'stderr': ''} - packages, urls = get_want_state(name) - - # add oldpackage flag when a version is given to allow downgrades - if any(p.version for p in packages): - m.params['oldpackage'] = True - - if not want_latest: - # for state=present: filter out already installed packages - # if a version is given leave the package in to let zypper handle the version - # resolution - packageswithoutversion = [p for p in packages if not p.version] - prerun_state = get_installed_state(m, packageswithoutversion) - # generate lists of packages to install or remove - packages = [p for p in packages if p.shouldinstall != (p.name in prerun_state)] - - if not packages and not urls: - # nothing to install/remove and nothing to update - return None, retvals - - # zypper install also updates packages - cmd = get_cmd(m, 'install') - cmd.append('--') - cmd.extend(urls) - # pass packages to zypper - # allow for + or - prefixes in install/remove lists - # also add version specifier if given - # do this in one zypper run to allow for dependency-resolution - # for example "-exim postfix" runs without removing packages depending on mailserver - cmd.extend([str(p) for p in packages]) - - retvals['cmd'] = cmd - result, retvals['rc'], retvals['stdout'], retvals['stderr'] = parse_zypper_xml(m, cmd) - - return result, retvals - - -def package_update_all(m): - "run update or patch on all available packages" - - retvals = {'rc': 0, 'stdout': '', 'stderr': ''} - if m.params['type'] == 'patch': - cmdname = 'patch' - elif m.params['state'] == 'dist-upgrade': - cmdname = 'dist-upgrade' - else: - cmdname = 'update' - - cmd = get_cmd(m, cmdname) - retvals['cmd'] = cmd - result, retvals['rc'], retvals['stdout'], retvals['stderr'] = parse_zypper_xml(m, cmd) - return result, retvals - - -def package_absent(m, name): - "remove the packages in name" - retvals = {'rc': 0, 'stdout': '', 'stderr': ''} - # Get package state - packages, urls = get_want_state(name, remove=True) - if any(p.prefix == '+' for p in packages): - m.fail_json(msg="Can not combine '+' prefix with state=remove/absent.") - if urls: - m.fail_json(msg="Can not remove via URL.") - if m.params['type'] == 'patch': - m.fail_json(msg="Can not remove patches.") - prerun_state = get_installed_state(m, packages) - packages = [p for p in packages if p.name in prerun_state] - - if not packages: - return None, retvals - - cmd = get_cmd(m, 'remove') - cmd.extend([p.name + p.version for p in packages]) - - retvals['cmd'] = cmd - result, retvals['rc'], retvals['stdout'], retvals['stderr'] = parse_zypper_xml(m, cmd) - return result, retvals - - -def repo_refresh(m): - "update the repositories" - retvals = {'rc': 0, 'stdout': '', 'stderr': ''} - - cmd = get_cmd(m, 'refresh') - - retvals['cmd'] = cmd - result, retvals['rc'], retvals['stdout'], retvals['stderr'] = parse_zypper_xml(m, cmd) - - return retvals - -# =========================================== -# Main control flow - - -def main(): - module = AnsibleModule( - argument_spec=dict( - name=dict(required=True, aliases=['pkg'], type='list'), - state=dict(required=False, default='present', choices=['absent', 'installed', 'latest', 'present', 'removed', 'dist-upgrade']), - type=dict(required=False, default='package', choices=['package', 'patch', 'pattern', 'product', 'srcpackage', 'application']), - extra_args_precommand=dict(required=False, default=None), - disable_gpg_check=dict(required=False, default='no', type='bool'), - disable_recommends=dict(required=False, default='yes', type='bool'), - force=dict(required=False, default='no', type='bool'), - force_resolution=dict(required=False, default='no', type='bool'), - update_cache=dict(required=False, aliases=['refresh'], default='no', type='bool'), - oldpackage=dict(required=False, default='no', type='bool'), - extra_args=dict(required=False, default=None), - ), - supports_check_mode=True - ) - - name = module.params['name'] - state = module.params['state'] - update_cache = module.params['update_cache'] - - # remove empty strings from package list - name = list(filter(None, name)) - - # Refresh repositories - if update_cache and not module.check_mode: - retvals = repo_refresh(module) - - if retvals['rc'] != 0: - module.fail_json(msg="Zypper refresh run failed.", **retvals) - - # Perform requested action - if name == ['*'] and state in ['latest', 'dist-upgrade']: - packages_changed, retvals = package_update_all(module) - elif name != ['*'] and state == 'dist-upgrade': - module.fail_json(msg="Can not dist-upgrade specific packages.") - else: - if state in ['absent', 'removed']: - packages_changed, retvals = package_absent(module, name) - elif state in ['installed', 'present', 'latest']: - packages_changed, retvals = package_present(module, name, state == 'latest') - - retvals['changed'] = retvals['rc'] == 0 and bool(packages_changed) - - if module._diff: - set_diff(module, retvals, packages_changed) - - if retvals['rc'] != 0: - module.fail_json(msg="Zypper run failed.", **retvals) - - if not retvals['changed']: - del retvals['stdout'] - del retvals['stderr'] - - module.exit_json(name=name, state=state, update_cache=update_cache, **retvals) - - -if __name__ == "__main__": - main() diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/cli_config.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/cli_config.py index 089b339..1dbf890 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/cli_config.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/cli_config.py @@ -16,9 +16,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type from ansible_collections.ansible.netcommon.plugins.action.network import ( ActionModule as ActionNetworkModule, diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/net_get.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/net_get.py index c6dbb2c..448b970 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/net_get.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/net_get.py @@ -14,9 +14,8 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type import os import re diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/net_put.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/net_put.py index 6fa3b8d..38403c7 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/net_put.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/net_put.py @@ -14,9 +14,8 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type import os import uuid diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/network.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/network.py index fbcc9c1..5c4c9fa 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/network.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/action/network.py @@ -16,9 +16,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type import os import time diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py index d0d977f..467c4b7 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py @@ -2,9 +2,8 @@ # (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type DOCUMENTATION = """ author: diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/persistent.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/persistent.py index c7379a6..6866688 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/persistent.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/persistent.py @@ -2,9 +2,8 @@ # (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type DOCUMENTATION = """author: Ansible Core Team connection: persistent diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/doc_fragments/connection_persistent.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/doc_fragments/connection_persistent.py index d572c30..506b559 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/doc_fragments/connection_persistent.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/doc_fragments/connection_persistent.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations class ModuleDocFragment(object): diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/compat/ipaddress.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/compat/ipaddress.py index dc0a19f..312f1d6 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/compat/ipaddress.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/compat/ipaddress.py @@ -60,7 +60,7 @@ and networks. """ -from __future__ import unicode_literals +from __future__ import annotations import itertools diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/cfg/base.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/cfg/base.py index 68608d1..75f80aa 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/cfg/base.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/cfg/base.py @@ -6,6 +6,7 @@ """ The base class for all resource modules """ +from __future__ import annotations from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network import ( get_resource_connection, diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/config.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/config.py index 6415040..d6f278a 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/config.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/config.py @@ -25,6 +25,8 @@ # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +from __future__ import annotations + import re import hashlib diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py index 2afa650..0a484d0 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py @@ -7,6 +7,8 @@ The facts base class this contains methods common to all facts subsets """ +from __future__ import annotations + from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network import ( get_resource_connection, ) diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py index 1857f7d..4979dac 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py @@ -25,6 +25,8 @@ # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +from __future__ import annotations + import sys from ansible.module_utils.common.text.converters import to_text, to_bytes diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/network.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/network.py index 149b441..c1f1d7b 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/network.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/network.py @@ -24,6 +24,7 @@ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +from __future__ import annotations import traceback import json diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/parsing.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/parsing.py index 2dd1de9..2e8e174 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/parsing.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/parsing.py @@ -24,6 +24,7 @@ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +from __future__ import annotations import re import shlex diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/utils.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/utils.py index 4095f59..0b594ad 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/utils.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/utils.py @@ -27,6 +27,7 @@ # # Networking tools for network modules only +from __future__ import annotations import re import ast diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/modules/cli_config.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/modules/cli_config.py index 9d07e85..ef6f102 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/modules/cli_config.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/modules/cli_config.py @@ -4,9 +4,7 @@ # (c) 2018, Ansible by Red Hat, inc # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations ANSIBLE_METADATA = { diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py index a38a775..29faa8b 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py @@ -2,9 +2,8 @@ # (c) 2015 Toshio Kuratomi <tkuratomi@ansible.com> # (c) 2017, Peter Sprygada <psprygad@redhat.com> # (c) 2017 Ansible Project -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type import os diff --git a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/action/ios.py b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/action/ios.py index e3605d0..be70895 100644 --- a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/action/ios.py +++ b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/action/ios.py @@ -16,9 +16,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type import sys import copy diff --git a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/cliconf/ios.py b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/cliconf/ios.py index b9cb19d..1b5cb45 100644 --- a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/cliconf/ios.py +++ b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/cliconf/ios.py @@ -16,9 +16,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/doc_fragments/ios.py b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/doc_fragments/ios.py index ff22d27..1b4ede2 100644 --- a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/doc_fragments/ios.py +++ b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/doc_fragments/ios.py @@ -2,6 +2,7 @@ # Copyright: (c) 2015, Peter Sprygada <psprygada@ansible.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations class ModuleDocFragment(object): diff --git a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/module_utils/network/ios/ios.py b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/module_utils/network/ios/ios.py index c16d84c..a21e047 100644 --- a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/module_utils/network/ios/ios.py +++ b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/module_utils/network/ios/ios.py @@ -25,6 +25,8 @@ # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +from __future__ import annotations + import json from ansible.module_utils.common.text.converters import to_text diff --git a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/modules/ios_command.py b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/modules/ios_command.py index 0b3be2a..9486a03 100644 --- a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/modules/ios_command.py +++ b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/modules/ios_command.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # +from __future__ import annotations ANSIBLE_METADATA = { "metadata_version": "1.1", diff --git a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/modules/ios_config.py b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/modules/ios_config.py index 5048bbb..f9b49a1 100644 --- a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/modules/ios_config.py +++ b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/modules/ios_config.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # +from __future__ import annotations ANSIBLE_METADATA = { "metadata_version": "1.1", diff --git a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/terminal/ios.py b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/terminal/ios.py index 9716952..7194eb4 100644 --- a/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/terminal/ios.py +++ b/test/support/network-integration/collections/ansible_collections/cisco/ios/plugins/terminal/ios.py @@ -16,9 +16,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type import json import re diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/action/vyos.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/action/vyos.py index b86a0c4..7865916 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/action/vyos.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/action/vyos.py @@ -16,9 +16,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type import sys import copy diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/cliconf/vyos.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/cliconf/vyos.py index 1f351dc..ca54c91 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/cliconf/vyos.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/cliconf/vyos.py @@ -16,9 +16,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type DOCUMENTATION = """ --- diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/doc_fragments/vyos.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/doc_fragments/vyos.py index 094963f..a7f8c12 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/doc_fragments/vyos.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/doc_fragments/vyos.py @@ -2,6 +2,7 @@ # Copyright: (c) 2015, Peter Sprygada <psprygada@ansible.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations class ModuleDocFragment(object): diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/facts/facts.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/facts/facts.py index 46fabaa..afe04ba 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/facts/facts.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/facts/facts.py @@ -4,9 +4,7 @@ """ The arg spec for the vyos facts module. """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations class FactsArgs(object): # pylint: disable=R0903 diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py index a018cc0..51822ac 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py @@ -25,9 +25,7 @@ The arg spec for the vyos_firewall_rules module """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations class Firewall_rulesArgs(object): # pylint: disable=R0903 diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py index 3542cb1..7bf0c22 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py @@ -23,9 +23,7 @@ The arg spec for the vyos_interfaces module """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations class InterfacesArgs(object): # pylint: disable=R0903 diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py index 91434e4..9ce2af5 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py @@ -26,9 +26,7 @@ The arg spec for the vyos_l3_interfaces module """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations class L3_interfacesArgs(object): # pylint: disable=R0903 diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py index 97c5d5a..b68513f 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py @@ -23,9 +23,7 @@ """ The arg spec for the vyos_lag_interfaces module """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations class Lag_interfacesArgs(object): # pylint: disable=R0903 diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py index 84bbc00..d56ff21 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py @@ -23,9 +23,7 @@ """ The arg spec for the vyos_lldp_global module """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations class Lldp_globalArgs(object): # pylint: disable=R0903 diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py index 2976fc0..7a639fe 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py @@ -25,9 +25,7 @@ The arg spec for the vyos_lldp_interfaces module """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations class Lldp_interfacesArgs(object): # pylint: disable=R0903 diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py index 8ecd955..191dc76 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py @@ -25,9 +25,7 @@ The arg spec for the vyos_static_routes module """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations class Static_routesArgs(object): # pylint: disable=R0903 diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py index 377fec9..5b61427 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py @@ -11,9 +11,7 @@ necessary to bring the current configuration to it's desired end-state is created """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/facts.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/facts.py index 8f0a3bb..f174849 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/facts.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/facts.py @@ -6,9 +6,8 @@ The facts class for vyos this file validates each subset of facts and selectively calls the appropriate facts gathering function """ -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts import ( FactsBase, ) diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py index 971ea6f..6e583f6 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py @@ -9,9 +9,8 @@ It is in this file the configuration is collected from the device for a given resource, parsed, and the facts tree is populated based on the configuration. """ -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type from re import findall, search, M from copy import deepcopy diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/interfaces/interfaces.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/interfaces/interfaces.py index 4b24803..e3bb52c 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/interfaces/interfaces.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/interfaces/interfaces.py @@ -10,9 +10,7 @@ for a given resource, parsed, and the facts tree is populated based on the configuration. """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations from re import findall, M diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py index d1d62c2..944629c 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py @@ -10,9 +10,7 @@ for a given resource, parsed, and the facts tree is populated based on the configuration. """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations import re diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/lag_interfaces/lag_interfaces.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/lag_interfaces/lag_interfaces.py index 9201e5c..b26dfd1 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/lag_interfaces/lag_interfaces.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/lag_interfaces/lag_interfaces.py @@ -9,9 +9,8 @@ It is in this file the configuration is collected from the device for a given resource, parsed, and the facts tree is populated based on the configuration. """ -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type from re import findall, search, M from copy import deepcopy diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/legacy/base.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/legacy/base.py index f6b343e..c5294b5 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/legacy/base.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/legacy/base.py @@ -9,9 +9,8 @@ for a given resource, parsed, and the facts tree is populated based on the configuration. """ -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type import platform import re from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import ( diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py index 3c7e2f9..10f239f 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py @@ -9,9 +9,8 @@ It is in this file the configuration is collected from the device for a given resource, parsed, and the facts tree is populated based on the configuration. """ -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type from re import findall, M from copy import deepcopy diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py index dcfbc6e..d9d59b1 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py @@ -10,9 +10,7 @@ for a given resource, parsed, and the facts tree is populated based on the configuration. """ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type +from __future__ import annotations from re import findall, search, M diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/static_routes/static_routes.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/static_routes/static_routes.py index 0004947..7ca7f20 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/static_routes/static_routes.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/facts/static_routes/static_routes.py @@ -10,9 +10,8 @@ for a given resource, parsed, and the facts tree is populated based on the configuration. """ -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type from re import findall, search, M from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/utils/utils.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/utils/utils.py index 402adfc..1a6a724 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/utils/utils.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/utils/utils.py @@ -4,9 +4,8 @@ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # utils -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type from ansible.module_utils.six import iteritems from ansible_collections.ansible.netcommon.plugins.module_utils.compat import ( ipaddress, diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/vyos.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/vyos.py index 7e8b204..274a463 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/vyos.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/vyos.py @@ -25,6 +25,8 @@ # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +from __future__ import annotations + import json from ansible.module_utils.common.text.converters import to_text diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_command.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_command.py index 7f7c30c..ed90aea 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_command.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_command.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # +from __future__ import annotations ANSIBLE_METADATA = { "metadata_version": "1.1", diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_config.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_config.py index e65f3ff..fdd42f6 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_config.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_config.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # +from __future__ import annotations ANSIBLE_METADATA = { "metadata_version": "1.1", diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py index 19fb727..d9fb236 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py @@ -6,6 +6,7 @@ """ The module file for vyos_facts """ +from __future__ import annotations ANSIBLE_METADATA = { diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_lldp_interfaces.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_lldp_interfaces.py index 8fe572b..d18f3f7 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_lldp_interfaces.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_lldp_interfaces.py @@ -26,9 +26,8 @@ The module file for vyos_lldp_interfaces """ -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type ANSIBLE_METADATA = { "metadata_version": "1.1", diff --git a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/terminal/vyos.py b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/terminal/vyos.py index fe7712f..77ef3e2 100644 --- a/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/terminal/vyos.py +++ b/test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/terminal/vyos.py @@ -16,9 +16,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -from __future__ import absolute_import, division, print_function +from __future__ import annotations -__metaclass__ = type import os import re diff --git a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/action/win_copy.py b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/action/win_copy.py index 79f72ef..f68b2ab 100644 --- a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/action/win_copy.py +++ b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/action/win_copy.py @@ -3,9 +3,7 @@ # Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type +from __future__ import annotations import base64 import json @@ -155,7 +153,7 @@ def _walk_dirs(topdir, loader, decrypt=True, base_path=None, local_follow=False, new_parents.add((parent_stat.st_dev, parent_stat.st_ino)) if (dir_stats.st_dev, dir_stats.st_ino) in new_parents: - # This was a a circular symlink. So add it as + # This was a circular symlink. So add it as # a symlink r_files['symlinks'].append({"src": os.readlink(dirpath), "dest": dest_dirpath}) else: diff --git a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/action/win_reboot.py b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/action/win_reboot.py index f1fad4d..8d66737 100644 --- a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/action/win_reboot.py +++ b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/action/win_reboot.py @@ -1,8 +1,7 @@ # Copyright: (c) 2018, Matt Davis <mdavis@ansible.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type +from __future__ import annotations from ansible.errors import AnsibleError from ansible.module_utils.common.text.converters import to_native diff --git a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/plugin_utils/_quote.py b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/plugin_utils/_quote.py index 718a099..d01386e 100644 --- a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/plugin_utils/_quote.py +++ b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/plugin_utils/_quote.py @@ -14,8 +14,7 @@ not final and could be subject to change. # See also: https://github.com/ansible/community/issues/539#issuecomment-780839686 # Please open an issue if you have questions about this. -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type +from __future__ import annotations import re diff --git a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/plugin_utils/_reboot.py b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/plugin_utils/_reboot.py index 2399ee4..ca0adcf 100644 --- a/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/plugin_utils/_reboot.py +++ b/test/support/windows-integration/collections/ansible_collections/ansible/windows/plugins/plugin_utils/_reboot.py @@ -13,6 +13,7 @@ interface is not final and count be subject to change. # and may not remain stable to outside uses. Changes may be made in ANY release, even a bugfix release. # See also: https://github.com/ansible/community/issues/539#issuecomment-780839686 # Please open an issue if you have questions about this. +from __future__ import annotations import datetime import json diff --git a/test/support/windows-integration/plugins/action/win_copy.py b/test/support/windows-integration/plugins/action/win_copy.py index 79f72ef..f68b2ab 100644 --- a/test/support/windows-integration/plugins/action/win_copy.py +++ b/test/support/windows-integration/plugins/action/win_copy.py @@ -3,9 +3,7 @@ # Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type +from __future__ import annotations import base64 import json @@ -155,7 +153,7 @@ def _walk_dirs(topdir, loader, decrypt=True, base_path=None, local_follow=False, new_parents.add((parent_stat.st_dev, parent_stat.st_ino)) if (dir_stats.st_dev, dir_stats.st_ino) in new_parents: - # This was a a circular symlink. So add it as + # This was a circular symlink. So add it as # a symlink r_files['symlinks'].append({"src": os.readlink(dirpath), "dest": dest_dirpath}) else: diff --git a/test/support/windows-integration/plugins/action/win_reboot.py b/test/support/windows-integration/plugins/action/win_reboot.py index 76f4a66..a2dfe90 100644 --- a/test/support/windows-integration/plugins/action/win_reboot.py +++ b/test/support/windows-integration/plugins/action/win_reboot.py @@ -1,8 +1,7 @@ # Copyright: (c) 2018, Matt Davis <mdavis@ansible.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type +from __future__ import annotations from datetime import datetime, timezone diff --git a/test/support/windows-integration/plugins/action/win_template.py b/test/support/windows-integration/plugins/action/win_template.py index 20494b9..dd5c0bc 100644 --- a/test/support/windows-integration/plugins/action/win_template.py +++ b/test/support/windows-integration/plugins/action/win_template.py @@ -15,9 +15,7 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type +from __future__ import annotations from ansible.plugins.action import ActionBase from ansible.plugins.action.template import ActionModule as TemplateActionModule diff --git a/test/support/windows-integration/plugins/become/runas.py b/test/support/windows-integration/plugins/become/runas.py index c8ae881..80cbe75 100644 --- a/test/support/windows-integration/plugins/become/runas.py +++ b/test/support/windows-integration/plugins/become/runas.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- # Copyright: (c) 2018, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type +from __future__ import annotations DOCUMENTATION = """ become: runas |