diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index feee3f2c27..61569b0c2d 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -140,16 +140,12 @@ stages: parameters: testFormat: devel/{0} targets: - - name: OS X 10.11 - test: osx/10.11 - - name: macOS 10.15 - test: macos/10.15 - name: macOS 11.1 test: macos/11.1 - - name: RHEL 7.8 - test: rhel/7.8 - - name: RHEL 8.2 - test: rhel/8.2 + - name: RHEL 7.9 + test: rhel/7.9 + - name: RHEL 8.3 + test: rhel/8.3 - name: FreeBSD 11.4 test: freebsd/11.4 - name: FreeBSD 12.2 @@ -166,8 +162,14 @@ stages: parameters: testFormat: 2.10/{0} targets: + - name: OS X 10.11 + test: osx/10.11 + - name: macOS 10.15 + test: macos/10.15 - name: macOS 11.1 test: macos/11.1 + - name: RHEL 7.8 + test: rhel/7.8 - name: RHEL 8.2 test: rhel/8.2 - name: FreeBSD 12.1 @@ -214,8 +216,6 @@ stages: test: opensuse15py2 - name: openSUSE 15 py3 test: opensuse15 - - name: Ubuntu 16.04 - test: ubuntu1604 - name: Ubuntu 18.04 test: ubuntu1804 - name: Ubuntu 20.04 @@ -238,6 +238,8 @@ stages: test: fedora32 - name: openSUSE 15 py3 test: opensuse15 + - name: Ubuntu 16.04 + test: ubuntu1604 groups: - 2 - 3 diff --git a/plugins/inventory/proxmox.py b/plugins/inventory/proxmox.py index 60623cd2f6..da727b7a20 100644 --- a/plugins/inventory/proxmox.py +++ b/plugins/inventory/proxmox.py @@ -226,10 +226,8 @@ class InventoryModule(BaseInventoryPlugin, Cacheable): if config == 'rootfs' or config.startswith(('virtio', 'sata', 'ide', 'scsi')): value = ('disk_image=' + value) - if isinstance(value, int) or ',' not in value: - value = value - # split off strings with commas to a dict - else: + if not (isinstance(value, int) or ',' not in value): + # split off strings with commas to a dict # skip over any keys that cannot be processed try: value = dict(key.split("=") for key in value.split(",")) diff --git a/plugins/inventory/virtualbox.py b/plugins/inventory/virtualbox.py index 683e4ddd69..3827aa0d1a 100644 --- a/plugins/inventory/virtualbox.py +++ b/plugins/inventory/virtualbox.py @@ -216,7 +216,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): yield host not in v yield True - return all([found_host for found_host in find_host(host, inventory)]) + return all(find_host(host, inventory)) def verify_file(self, path): diff --git a/plugins/module_utils/cloud.py b/plugins/module_utils/cloud.py index 33b3308452..d90d1f5234 100644 --- a/plugins/module_utils/cloud.py +++ b/plugins/module_utils/cloud.py @@ -130,7 +130,7 @@ class CloudRetry(object): try: return f(*args, **kwargs) except Exception as e: - if isinstance(e, cls.base_class): + if isinstance(e, cls.base_class): # pylint: disable=isinstance-second-argument-not-valid-type response_code = cls.status_code_from_exception(e) if cls.found(response_code, catch_extra_error_codes): msg = "{0}: Retrying in {1} seconds...".format(str(e), delay) diff --git a/plugins/module_utils/module_helper.py b/plugins/module_utils/module_helper.py index 42fb17d210..f35db8283d 100644 --- a/plugins/module_utils/module_helper.py +++ b/plugins/module_utils/module_helper.py @@ -284,7 +284,7 @@ class CmdMixin(object): def _calculate_args(self, extra_params=None, params=None): def add_arg_formatted_param(_cmd_args, arg_format, _value): - args = [x for x in arg_format.to_text(_value)] + args = list(arg_format.to_text(_value)) return _cmd_args + args def find_format(_param): diff --git a/plugins/modules/cloud/ovirt/ovirt_tag_facts.py b/plugins/modules/cloud/ovirt/ovirt_tag_facts.py index c6e9b7441a..a6ce97dd42 100644 --- a/plugins/modules/cloud/ovirt/ovirt_tag_facts.py +++ b/plugins/modules/cloud/ovirt/ovirt_tag_facts.py @@ -137,17 +137,13 @@ def main(): host = search_by_name(hosts_service, module.params['host']) if host is None: raise Exception("Host '%s' was not found." % module.params['host']) - tags.extend([ - tag for tag in hosts_service.host_service(host.id).tags_service().list() - ]) + tags.extend(hosts_service.host_service(host.id).tags_service().list()) if module.params['vm']: vms_service = connection.system_service().vms_service() vm = search_by_name(vms_service, module.params['vm']) if vm is None: raise Exception("Vm '%s' was not found." % module.params['vm']) - tags.extend([ - tag for tag in vms_service.vm_service(vm.id).tags_service().list() - ]) + tags.extend(vms_service.vm_service(vm.id).tags_service().list()) if not (module.params['vm'] or module.params['host'] or module.params['name']): tags = all_tags diff --git a/plugins/modules/packaging/os/openbsd_pkg.py b/plugins/modules/packaging/os/openbsd_pkg.py index 7432c48a63..61e2a5e52b 100644 --- a/plugins/modules/packaging/os/openbsd_pkg.py +++ b/plugins/modules/packaging/os/openbsd_pkg.py @@ -164,7 +164,7 @@ def get_package_state(names, pkg_spec, module): if stdout: # If the requested package name is just a stem, like "python", we may # find multiple packages with that name. - pkg_spec[name]['installed_names'] = [installed_name for installed_name in stdout.splitlines()] + pkg_spec[name]['installed_names'] = stdout.splitlines() module.debug("get_package_state(): installed_names = %s" % pkg_spec[name]['installed_names']) pkg_spec[name]['installed_state'] = True else: diff --git a/scripts/inventory/freeipa.py b/scripts/inventory/freeipa.py index 4a5bf67883..f7ffe1d223 100644 --- a/scripts/inventory/freeipa.py +++ b/scripts/inventory/freeipa.py @@ -67,10 +67,10 @@ def list_groups(api): members = [] if 'member_host' in hostgroup: - members = [host for host in hostgroup['member_host']] + members = list(hostgroup['member_host']) if 'memberindirect_host' in hostgroup: members += (host for host in hostgroup['memberindirect_host']) - inventory[hostgroup['cn'][0]] = {'hosts': [host for host in members]} + inventory[hostgroup['cn'][0]] = {'hosts': list(members)} for member in members: hostvars[member] = {} diff --git a/scripts/inventory/lxc_inventory.py b/scripts/inventory/lxc_inventory.py index 00de15c2be..5a40b40837 100644 --- a/scripts/inventory/lxc_inventory.py +++ b/scripts/inventory/lxc_inventory.py @@ -38,7 +38,7 @@ def build_dict(): for c in lxc.list_containers()]) # Extract the groups, flatten the list, and remove duplicates - groups = set(sum([g for g in containers.values()], [])) + groups = set(sum(containers.values(), [])) # Create a dictionary for each group (including the 'all' group return dict([(g, {'hosts': [k for k, v in containers.items() if g in v], diff --git a/tests/integration/targets/django_manage/aliases b/tests/integration/targets/django_manage/aliases index fcd92e1a91..e9c002109c 100644 --- a/tests/integration/targets/django_manage/aliases +++ b/tests/integration/targets/django_manage/aliases @@ -4,3 +4,4 @@ skip/freebsd skip/macos skip/osx skip/rhel8.2 +skip/rhel8.3 diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index 0ee04a42c9..cee8ab22ca 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -1,5 +1,6 @@ plugins/callback/hipchat.py pylint:blacklisted-name plugins/connection/lxc.py pylint:blacklisted-name +plugins/module_utils/cloud.py pylint:bad-option-value # a pylint test that is disabled was modified over time plugins/module_utils/compat/ipaddress.py no-assert plugins/module_utils/compat/ipaddress.py no-unicode-literals plugins/module_utils/_mount.py future-import-boilerplate diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index f746a78949..c14feab0c5 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -1,5 +1,6 @@ plugins/callback/hipchat.py pylint:blacklisted-name plugins/connection/lxc.py pylint:blacklisted-name +plugins/module_utils/cloud.py pylint:bad-option-value # a pylint test that is disabled was modified over time plugins/module_utils/compat/ipaddress.py no-assert plugins/module_utils/compat/ipaddress.py no-unicode-literals plugins/module_utils/_mount.py future-import-boilerplate diff --git a/tests/unit/plugins/modules/monitoring/test_monit.py b/tests/unit/plugins/modules/monitoring/test_monit.py index 1d30812efe..f0d6ac4935 100644 --- a/tests/unit/plugins/modules/monitoring/test_monit.py +++ b/tests/unit/plugins/modules/monitoring/test_monit.py @@ -97,7 +97,7 @@ class MonitTest(unittest.TestCase): self.monit.wait_for_monit_to_stop_pending() -@pytest.mark.parametrize('status_name', [name for name in monit.StatusValue.ALL_STATUS]) +@pytest.mark.parametrize('status_name', monit.StatusValue.ALL_STATUS) def test_status_value(status_name): value = getattr(monit.StatusValue, status_name.upper()) status = monit.StatusValue(value) diff --git a/tests/unit/plugins/modules/system/interfaces_file/test_interfaces_file.py b/tests/unit/plugins/modules/system/interfaces_file/test_interfaces_file.py index a96737c7a8..c39842f5a1 100644 --- a/tests/unit/plugins/modules/system/interfaces_file/test_interfaces_file.py +++ b/tests/unit/plugins/modules/system/interfaces_file/test_interfaces_file.py @@ -60,7 +60,7 @@ class TestInterfacesFileModule(unittest.TestCase): tofile=os.path.basename(backup)) # Restore backup move(backup, path) - deltas = [d for d in diffs] + deltas = list(diffs) self.assertTrue(len(deltas) == 0) def compareInterfacesLinesToFile(self, interfaces_lines, path, testname=None):