Sync with RHEL version 1.0.1-1.el8

Fix description field in galaxy.yml
Remove "Technology Preview" from Collection README
Merging individual ignore file and add it to the package
Add a note to each module Doc to indicate it is private
Add patches for network and storage role ansible-test fixes
Simplify doc tags in %files, corrects a forgotten doc tag for ha_cluster
Suppress one ansible-lint warning in ha_cluster
Add patch for the inclusive language leftover on network-role README.md

Related: rhbz#1961404
This commit is contained in:
Pavel Cahyna 2021-04-06 01:13:32 +02:00 committed by Noriko Hosoi
parent f6ce71d308
commit a9a9a29871
8 changed files with 4819 additions and 70 deletions

View File

@ -5,8 +5,7 @@ set -euxo pipefail
readme_md=${1:-"lsr_role2collection/collection_readme.md"}
sed -i -e '/## Currently supported distributions/{:1;/## Dependencies/!{N;b 1};s|.*|## Dependencies|}' \
-e 's/\(Linux System Roles is a set of roles for managing Linux system components.\)/\1\n\nThis collection is available as a Technology Preview./' \
-e 's/Linux/RHEL/g' \
-e 's/Linux/Red Hat Enterprise Linux/g' \
-e 's/Ansible Galaxy/Automation Hub/g' \
-e 's/fedora\(.\)linux_system_roles/redhat\1rhel_system_roles/g' \
-e 's/linux-system-roles/rhel-system-roles/g' \

View File

@ -131,27 +131,27 @@ BuildRequires: ansible >= 2.9.10
%global rolename8 tlog
%deftag 8 1.1.0
%defcommit 9 e5e5abb35fb695e22ccffa855c98ab882650480e
%defcommit 9 4c81fd1380712ab0641b6837f092dd9caeeae0a6
%global rolename9 kernel_settings
#%%deftag 9 1.0.1
%defcommit 10 4b07edf4e84882c9d0fb979092ba5953aac0b4d5
%defcommit 10 07e08107e7ccba5822f8a7aaec1a2ff0a221bede
%global rolename10 logging
#%%deftag 10 0.2.0
#%%defcommit 11 4b6cfca4dd24e53a4bc4e07635601d7c104346c1
%defcommit 11 4dfc5e2aca74cb82f2a50eec7e975a2b78ad9678
%global rolename11 nbde_server
%deftag 11 1.0.1
#%%deftag 11 1.0.1
%defcommit 12 3af7452e4861ee2363b29b23bf78bf11e06be142
%defcommit 12 19f06159582550c8463f7d8492669e26fbdf760b
%global rolename12 nbde_client
#%%deftag 12 1.0.1
%defcommit 13 50041ce55348fcce34aba4cbe3ea160c5d890ab3
%defcommit 13 0376ceece57882ade8ffaf431b7866aae3e7fed1
%global rolename13 certificate
#%%deftag 13 1.0.1
%defcommit 14 76b2d5b0460dba22c5d290c1af96e4fdb3434cb9
%defcommit 14 2e2941c5545571fc8bc494099bdf970f498b9d38
%global rolename14 crypto_policies
%global forgeorg15 https://github.com/willshersystems/
@ -159,13 +159,13 @@ BuildRequires: ansible >= 2.9.10
%global rolename15 sshd
%defcommit 15 e1de59b3c54e9d48a010eeca73755df339c7e628
%defcommit 16 effa0a0d993832dee726290f263a2182cf3eacda
%defcommit 16 21adc637511db86b5ba279a70a7301ef3a170669
%global rolename16 ssh
%defcommit 17 779bb78559de58bb5a1f25a4b92039c373ef59a4
%global rolename17 ha_cluster
%global mainid e5ed203b2d7224c0bf0c3fd55452456c8f468cad
%global mainid 8f069305caa0a142c2c6ac14bd4d331282a1c079
Source: %{url}auto-maintenance/archive/%{mainid}/auto-maintenance-%{mainid}.tar.gz
Source1: %{archiveurl1}
Source2: %{archiveurl2}
@ -194,8 +194,10 @@ Patch12: postfix-meta-el8.diff
Patch21: selinux-tier1-tags.diff
Patch22: selinux-bz-1926947-no-variable-named-present.diff
Patch23: selinux-ansible-test-issues.diff
Patch31: timesync-tier1-tags.diff
Patch32: timesync-ansible-test-issues.diff
Patch41: rhel-system-roles-kdump-pr22.diff
Patch42: kdump-tier1-tags.diff
@ -207,10 +209,13 @@ Patch51: network-epel-minimal.diff
Patch52: network-permissions.diff
Patch53: network-tier1-tags.diff
Patch55: network-disable-bondtests.diff
Patch56: network-pr353.diff
Patch57: network-ansible-test.diff
Patch62: storage-partition-name.diff
Patch63: storage-no-disks-existing.diff
Patch64: storage-trim-volume-size.diff
Patch65: storage-ansible-test.diff
Patch71: metrics-mssql-x86.diff
@ -266,9 +271,11 @@ cd ..
cd %{rolename2}
%patch21 -p1
%patch22 -p1
%patch23 -p1
cd ..
cd %{rolename3}
%patch31 -p1
%patch32 -p1
cd ..
cd %{rolename4}
%patch41 -p1
@ -281,11 +288,14 @@ cd %{rolename5}
%patch52 -p1
%patch53 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
cd ..
cd %{rolename6}
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
cd ..
cd %{rolename7}
%patch71 -p1
@ -346,26 +356,54 @@ mkdir .collections
# Convert the upstream collection readme to the downstream one
%{SOURCE998} lsr_role2collection/collection_readme.md
%endif
./galaxy_transform.py "%{collection_namespace}" "%{collection_name}" "%{collection_version}" > galaxy.yml.tmp
./galaxy_transform.py "%{collection_namespace}" "%{collection_name}" "%{collection_version}" "Red Hat Enterprise Linux System Roles Ansible Collection" > galaxy.yml.tmp
mv galaxy.yml.tmp galaxy.yml
for role in %{rolename1} %{rolename2} %{rolename3} \
%{rolename4} %{rolename5} %{rolename6} \
%{rolename7} %{rolename8} %{rolename9} \
%{rolename10} %{rolename11} %{rolename12} \
%{rolename13} %{rolename14} %{rolename15} \
%{rolename16} %{rolename17}; do
for role in %{rolenames}; do
python3 lsr_role2collection.py --role "$role" --src-path "$role" \
--src-owner %{name} --subrole-prefix %{subrole_prefix} --dest-path .collections \
--readme lsr_role2collection/collection_readme.md \
--namespace %{collection_namespace} --collection %{collection_name}
done
rm -f .collections/ansible_collections/%{collection_namespace}/%{collection_name}/tests/sanity/ignore-2.9.txt
# Merge .sanity-ansible-ignore-2.9-ROLENAME.txt into tests/sanity/ignore-2.9.txt
mkdir -p .collections/ansible_collections/%{collection_namespace}/%{collection_name}/tests/sanity
for role in %{rolenames}; do
if [ -f .collections/ansible_collections/%{collection_namespace}/%{collection_name}/.sanity-ansible-ignore-2.9-"$role".txt ];
then
cat .collections/ansible_collections/%{collection_namespace}/%{collection_name}/.sanity-ansible-ignore-2.9-"$role".txt \
>> .collections/ansible_collections/%{collection_namespace}/%{collection_name}/tests/sanity/ignore-2.9.txt
rm -f .collections/ansible_collections/%{collection_namespace}/%{collection_name}/.sanity-ansible-ignore-*-"$role".txt
fi
done
# removing dot files/dirs
rm -r .collections/ansible_collections/%{collection_namespace}/%{collection_name}/.[A-Za-z]*
cp -p galaxy.yml lsr_role2collection/.ansible-lint \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}
mkdir -p .collections/ansible_collections/%{collection_namespace}/%{collection_name}/tests/sanity
cp -p lsr_role2collection/ignore-2.9.txt \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/tests/sanity
# converting README.md to README.html
sh md2html.sh -l \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename1}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename2}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename3}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename4}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename5}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename6}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename7}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename8}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename9}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename10}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename11}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename12}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename13}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename14}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename15}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename16}/README.md \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename17}/README.md
cd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
%ansible_collection_build
@ -603,6 +641,22 @@ rmdir $RPM_BUILD_ROOT%{_datadir}/ansible/roles/%{roleprefix}ha_cluster/examples
cd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
%ansible_collection_install
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles
cp -p %{buildroot}%{ansible_collection_files}%{collection_name}/README.md \
%{buildroot}%{ansible_collection_files}%{collection_name}/README.html \
$RPM_BUILD_ROOT%{_pkgdocdir}/collection
for rolename in %{rolenames}; do
if [ -f %{buildroot}%{ansible_collection_files}%{collection_name}/roles/${rolename}/README.md ]; then
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${rolename}
cp -p %{buildroot}%{ansible_collection_files}%{collection_name}/roles/${rolename}/README.md \
%{buildroot}%{ansible_collection_files}%{collection_name}/roles/${rolename}/README.html \
$RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${rolename}
fi
done
%files
%if %{without ansible}
@ -652,39 +706,32 @@ cd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
%{_pkgdocdir}/network/example-inventory
%{_pkgdocdir}/*/README.md
%{_pkgdocdir}/*/README.html
%doc %{installbase}/%{roleinstprefix}kdump/README.md
%doc %{installbase}/%{roleinstprefix}postfix/README.md
%doc %{installbase}/%{roleinstprefix}selinux/README.md
%doc %{installbase}/%{roleinstprefix}timesync/README.md
%doc %{installbase}/%{roleinstprefix}network/README.md
%doc %{installbase}/%{roleinstprefix}storage/README.md
%doc %{installbase}/%{roleinstprefix}metrics/README.md
%doc %{installbase}/%{roleinstprefix}tlog/README.md
%doc %{installbase}/%{roleinstprefix}kernel_settings/README.md
%doc %{installbase}/%{roleinstprefix}logging/README.md
%doc %{installbase}/%{roleinstprefix}nbde_server/README.md
%doc %{installbase}/%{roleinstprefix}nbde_client/README.md
%doc %{installbase}/%{roleinstprefix}certificate/README.md
%doc %{installbase}/%{roleinstprefix}crypto_policies/README.md
%doc %{installbase}/%{roleinstprefix}sshd/README.md
%doc %{installbase}/%{roleinstprefix}ssh/README.md
%doc %{installbase}/%{roleinstprefix}kdump/README.html
%doc %{installbase}/%{roleinstprefix}postfix/README.html
%doc %{installbase}/%{roleinstprefix}selinux/README.html
%doc %{installbase}/%{roleinstprefix}timesync/README.html
%doc %{installbase}/%{roleinstprefix}network/README.html
%doc %{installbase}/%{roleinstprefix}storage/README.html
%doc %{installbase}/%{roleinstprefix}metrics/README.html
%doc %{installbase}/%{roleinstprefix}tlog/README.html
%doc %{installbase}/%{roleinstprefix}kernel_settings/README.html
%doc %{installbase}/%{roleinstprefix}logging/README.html
%doc %{installbase}/%{roleinstprefix}nbde_server/README.html
%doc %{installbase}/%{roleinstprefix}nbde_client/README.html
%doc %{installbase}/%{roleinstprefix}certificate/README.html
%doc %{installbase}/%{roleinstprefix}crypto_policies/README.html
%doc %{installbase}/%{roleinstprefix}sshd/README.html
%doc %{installbase}/%{roleinstprefix}ssh/README.html
%doc %{installbase}/%{roleinstprefix}ha_cluster/README.html
%{_pkgdocdir}/collection/roles/*/README.md
%{_pkgdocdir}/collection/roles/*/README.html
%doc %{installbase}/%{roleinstprefix}*/README.md
%doc %{installbase}/%{roleinstprefix}*/README.html
%doc %{ansible_collection_files}/%{collection_name}/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/kdump/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/postfix/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/selinux/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/timesync/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/network/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/storage/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/metrics/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/tlog/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/kernel_settings/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/logging/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/nbde_server/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/nbde_client/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/certificate/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/crypto_policies/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/sshd/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/ssh/README.md
%doc %{ansible_collection_files}/%{collection_name}/roles/ha_cluster/README.md
# can't use a glob for .md files, only for .html. .md files include READMEs
# for private subroles, and we don;t want to tag those as docs.
%doc %{ansible_collection_files}/%{collection_name}/README.html
%doc %{ansible_collection_files}/%{collection_name}/roles/*/README.html
%license %{_pkglicensedir}/*
%license %{installbase}/%{roleinstprefix}kdump/COPYING

View File

@ -1,16 +0,0 @@
# Copyright 2018 Red Hat, Inc.
# Author: Václav Doležal <vdolezal@redhat.com>
# THIS FILE IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
# OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
#
# Permission is hereby granted to use or copy this program
# for any purpose, provided the above notices are retained on all copies.
# Permission to modify the code and to distribute modified code is granted,
# provided the above notices are retained, and a notice that the code was
# modified is included with the above copyright notice.
for file in "$@"; do
pandoc -f markdown_github "${file}" -t asciidoc -o "${file%.md}.tmp.adoc" ||exit $?
touch -r "${file}" "${file%.md}.tmp.adoc" ||exit $?
TZ=UTC asciidoc -o "${file%.md}.html" -a footer-style=none -a toc2 -a source-highlighter=highlight "${file%.md}.tmp.adoc" ||exit $?
rm "${file%.md}.tmp.adoc"
done

835
network-ansible-test.diff Normal file
View File

@ -0,0 +1,835 @@
From 7ae16e9ff5291f06ba0d7224a0d6c36b780ea0a2 Mon Sep 17 00:00:00 2001
From: Rich Megginson <rmeggins@redhat.com>
Date: Wed, 3 Mar 2021 11:37:56 -0700
Subject: [PATCH] fix most ansible-test issues, suppress the rest
Automation Hub, and possibly Galaxy in the future, require the
collection to be screened with `ansible-test sanity` among other
checks. The role had a number of issues:
* Use `AssertionError` instead of `assert`
* Use of `logging` module not in accordance with standards, but these
are ok and the errors were suppressed
* Several import errors which are ok because they are checked
elsewhere
* Many of the module files use `#!` shebang - not sure why, but
the usage is allowed
* __init__.py in the module_utils directories must be empty, so a
new file myerror.py was added to move the code from __init__.py
* The documentation block in the module was not properly constructed
or formatted.
* shellcheck issues, including removing unused files
* use `dummy` instead of `_` (underscore) for variables that are
unused
add WARNING to module docs - collection users should not use directly
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
(cherry picked from commit 7459a29e9104bf01987399153baf0a1c1df05929)
---
.github/workflows/tox.yml | 4 +-
.sanity-ansible-ignore-2.9.txt | 47 ++++++++++
README.md | 2 +-
library/network_connections.py | 88 ++++++++++++-------
module_utils/network_lsr/__init__.py | 7 --
.../network_lsr/argument_validator.py | 9 +-
module_utils/network_lsr/ethtool.py | 6 +-
module_utils/network_lsr/myerror.py | 11 +++
module_utils/network_lsr/nm/__init__.py | 4 +
.../network_lsr/nm/active_connection.py | 35 ++++----
module_utils/network_lsr/nm/client.py | 4 +
module_utils/network_lsr/nm/connection.py | 18 ++--
module_utils/network_lsr/nm/error.py | 4 +
module_utils/network_lsr/nm/provider.py | 8 +-
module_utils/network_lsr/nm_provider.py | 4 +
module_utils/network_lsr/utils.py | 10 ++-
tests/ensure_provider_tests.py | 8 +-
tests/get_coverage.sh | 6 +-
tests/get_total_coverage.sh | 2 +-
tests/integration/test_ethernet.py | 4 +-
tests/merge_coverage.sh | 3 +
tests/setup_module_utils.sh | 41 ---------
tox.ini | 3 -
23 files changed, 199 insertions(+), 129 deletions(-)
create mode 100644 .sanity-ansible-ignore-2.9.txt
create mode 100644 module_utils/network_lsr/myerror.py
delete mode 100755 tests/setup_module_utils.sh
diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml
index 207bcba..ba0f4c6 100644
--- a/.github/workflows/tox.yml
+++ b/.github/workflows/tox.yml
@@ -3,7 +3,7 @@ name: tox
on: # yamllint disable-line rule:truthy
- pull_request
env:
- TOX_LSR: "git+https://github.com/linux-system-roles/tox-lsr@2.2.0"
+ TOX_LSR: "git+https://github.com/linux-system-roles/tox-lsr@2.3.0"
LSR_ANSIBLES: 'ansible==2.8.* ansible==2.9.*'
LSR_MSCENARIOS: default
# LSR_EXTRA_PACKAGES: "libdbus-1-dev libgirepository1.0-dev python3-dev"
@@ -36,7 +36,7 @@ jobs:
toxenvs="py${toxpyver}"
case "$toxpyver" in
27) toxenvs="${toxenvs},coveralls,flake8,pylint" ;;
- 36) toxenvs="${toxenvs},coveralls,black,yamllint,ansible-lint,collection" ;;
+ 36) toxenvs="${toxenvs},coveralls,black,yamllint,ansible-lint,collection,ansible-test" ;;
37) toxenvs="${toxenvs},coveralls" ;;
38) toxenvs="${toxenvs},coveralls" ;;
esac
diff --git a/.sanity-ansible-ignore-2.9.txt b/.sanity-ansible-ignore-2.9.txt
new file mode 100644
index 0000000..439197e
--- /dev/null
+++ b/.sanity-ansible-ignore-2.9.txt
@@ -0,0 +1,47 @@
+tests/network/ensure_provider_tests.py compile-2.7!skip
+tests/network/ensure_provider_tests.py compile-3.5!skip
+plugins/module_utils/network_lsr/nm/__init__.py empty-init!skip
+plugins/module_utils/network_lsr/nm/active_connection.py import-2.7!skip
+plugins/module_utils/network_lsr/nm/client.py import-2.7!skip
+plugins/module_utils/network_lsr/nm/connection.py import-2.7!skip
+plugins/module_utils/network_lsr/nm/provider.py import-2.7!skip
+plugins/module_utils/network_lsr/nm/active_connection.py import-3.5!skip
+plugins/module_utils/network_lsr/nm/client.py import-3.5!skip
+plugins/module_utils/network_lsr/nm/connection.py import-3.5!skip
+plugins/module_utils/network_lsr/nm/provider.py import-3.5!skip
+plugins/module_utils/network_lsr/nm/active_connection.py import-3.6!skip
+plugins/module_utils/network_lsr/nm/client.py import-3.6!skip
+plugins/module_utils/network_lsr/nm/connection.py import-3.6!skip
+plugins/module_utils/network_lsr/nm/provider.py import-3.6!skip
+plugins/module_utils/network_lsr/nm/active_connection.py import-3.7!skip
+plugins/module_utils/network_lsr/nm/client.py import-3.7!skip
+plugins/module_utils/network_lsr/nm/connection.py import-3.7!skip
+plugins/module_utils/network_lsr/nm/provider.py import-3.7!skip
+plugins/module_utils/network_lsr/nm/active_connection.py import-3.8!skip
+plugins/module_utils/network_lsr/nm/client.py import-3.8!skip
+plugins/module_utils/network_lsr/nm/connection.py import-3.8!skip
+plugins/module_utils/network_lsr/nm/provider.py import-3.8!skip
+plugins/module_utils/network_lsr/__init__.py shebang!skip
+plugins/module_utils/network_lsr/argument_validator.py shebang!skip
+plugins/module_utils/network_lsr/utils.py shebang!skip
+plugins/module_utils/network_lsr/myerror.py shebang!skip
+tests/network/covstats shebang!skip
+tests/network/ensure_provider_tests.py shebang!skip
+tests/network/get_coverage.sh shebang!skip
+tests/network/get_total_coverage.sh shebang!skip
+tests/network/merge_coverage.sh shebang!skip
+tests/network/ensure_provider_tests.py future-import-boilerplate!skip
+tests/network/integration/conftest.py future-import-boilerplate!skip
+tests/network/integration/test_ethernet.py future-import-boilerplate!skip
+tests/network/unit/test_network_connections.py future-import-boilerplate!skip
+tests/network/unit/test_nm_provider.py future-import-boilerplate!skip
+tests/network/ensure_provider_tests.py metaclass-boilerplate!skip
+tests/network/integration/conftest.py metaclass-boilerplate!skip
+tests/network/integration/test_ethernet.py metaclass-boilerplate!skip
+tests/network/unit/test_network_connections.py metaclass-boilerplate!skip
+tests/network/unit/test_nm_provider.py metaclass-boilerplate!skip
+plugins/modules/network_connections.py validate-modules:missing-examples
+plugins/modules/network_connections.py validate-modules:missing-gplv3-license
+plugins/modules/network_connections.py validate-modules:no-default-for-required-parameter
+plugins/modules/network_connections.py validate-modules:parameter-type-not-in-doc
+plugins/modules/network_connections.py validate-modules:undocumented-parameter
diff --git a/README.md b/README.md
index c1462b6..c257c08 100644
--- a/README.md
+++ b/README.md
@@ -145,7 +145,7 @@ a consequence, `state: up` always changes the system.
You can deactivate a connection profile, even if is currently not active. As a consequence, `state: down` always changes the system.
-Note that if the `state` option is unset, the connection profiles runtime state will not be changed.
+Note that if the `state` option is unset, the connection profile's runtime state will not be changed.
### `persistent_state`
diff --git a/library/network_connections.py b/library/network_connections.py
index 3224892..3a6e47f 100644
--- a/library/network_connections.py
+++ b/library/network_connections.py
@@ -2,6 +2,30 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: BSD-3-Clause
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+DOCUMENTATION = """
+---
+module: network_connections
+author: Thomas Haller (@thom311)
+short_description: module for network role to manage connection profiles
+requirements: [pygobject, dbus, NetworkManager]
+version_added: "2.0"
+description:
+ - "WARNING: Do not use this module directly! It is only for role internal use."
+ - |
+ Manage networking profiles (connections) for NetworkManager and
+ initscripts networking providers. Documentation needs to be written. Note
+ that the network_connections module tightly integrates with the network
+ role and currently it is not expected to use this module outside the role.
+ Thus, consult README.md for examples for the role. The requirements are
+ only for the NetworkManager (nm) provider.
+options: {}
+"""
+
+
import errno
import functools
import os
@@ -16,7 +40,7 @@ import logging
# pylint: disable=import-error, no-name-in-module
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network_lsr import ethtool # noqa:E501
-from ansible.module_utils.network_lsr import MyError # noqa:E501
+from ansible.module_utils.network_lsr.myerror import MyError # noqa:E501
from ansible.module_utils.network_lsr.argument_validator import ( # noqa:E501
ArgUtil,
@@ -30,22 +54,6 @@ from ansible.module_utils.network_lsr import nm_provider # noqa:E501
# pylint: enable=import-error, no-name-in-module
-DOCUMENTATION = """
----
-module: network_connections
-author: "Thomas Haller (thaller@redhat.com)"
-short_description: module for network role to manage connection profiles
-requirements: for 'nm' provider requires pygobject, dbus and NetworkManager.
-version_added: "2.0"
-description: Manage networking profiles (connections) for NetworkManager and
- initscripts networking providers.
-options: Documentation needs to be written. Note that the network_connections
- module tightly integrates with the network role and currently it is not
- expected to use this module outside the role. Thus, consult README.md for
- examples for the role.
-"""
-
-
###############################################################################
PERSISTENT_STATE = "persistent_state"
ABSENT_STATE = "absent"
@@ -772,7 +780,7 @@ class NMUtil:
if compare_flags is None:
compare_flags = NM.SettingCompareFlags.IGNORE_TIMESTAMP
- return not (not (con_a.compare(con_b, compare_flags)))
+ return con_a.compare(con_b, compare_flags)
def connection_is_active(self, con):
NM = Util.NM()
@@ -1390,7 +1398,7 @@ class RunEnvironment(object):
def check_mode_set(self, check_mode, connections=None):
c = self._check_mode
self._check_mode = check_mode
- assert (
+ if not (
(c is None and check_mode in [CheckMode.PREPARE])
or (
c == CheckMode.PREPARE
@@ -1399,7 +1407,8 @@ class RunEnvironment(object):
or (c == CheckMode.PRE_RUN and check_mode in [CheckMode.REAL_RUN])
or (c == CheckMode.REAL_RUN and check_mode in [CheckMode.DONE])
or (c == CheckMode.DRY_RUN and check_mode in [CheckMode.DONE])
- )
+ ):
+ raise AssertionError("check_mode value is incorrect {0}".format(c))
self._check_mode_changed(c, check_mode, connections)
@@ -1461,7 +1470,8 @@ class RunEnvironmentAnsible(RunEnvironment):
warn_traceback=False,
force_fail=False,
):
- assert idx >= -1
+ if not idx >= -1:
+ raise AssertionError("idx {0} is less than -1".format(idx))
self._log_idx += 1
self.run_results[idx]["log"].append((severity, msg, self._log_idx))
if severity == LogLevel.ERROR:
@@ -1598,14 +1608,15 @@ class Cmd(object):
def connections_data(self):
c = self._connections_data
if c is None:
- assert self.check_mode in [
+ if self.check_mode not in [
CheckMode.DRY_RUN,
CheckMode.PRE_RUN,
CheckMode.REAL_RUN,
- ]
- c = []
- for _ in range(0, len(self.connections)):
- c.append({"changed": False})
+ ]:
+ raise AssertionError(
+ "invalid value {0} for self.check_mode".format(self.check_mode)
+ )
+ c = [{"changed": False}] * len(self.connections)
self._connections_data = c
return c
@@ -1614,11 +1625,14 @@ class Cmd(object):
c["changed"] = False
def connections_data_set_changed(self, idx, changed=True):
- assert self._check_mode in [
+ if self._check_mode not in [
CheckMode.PRE_RUN,
CheckMode.DRY_RUN,
CheckMode.REAL_RUN,
- ]
+ ]:
+ raise AssertionError(
+ "invalid value {0} for self._check_mode".format(self._check_mode)
+ )
if not changed:
return
self.connections_data[idx]["changed"] = changed
@@ -1688,7 +1702,10 @@ class Cmd(object):
# modify the connection.
con = self.connections[idx]
- assert con["state"] in ["up", "down"]
+ if con["state"] not in ["up", "down"]:
+ raise AssertionError(
+ "connection state {0} not 'up' or 'down'".format(con["state"])
+ )
# also check, if the current profile is 'up' with a 'type' (which
# possibly modifies the connection as well)
@@ -1736,7 +1753,9 @@ class Cmd(object):
elif self._check_mode != CheckMode.DONE:
c = CheckMode.DONE
else:
- assert False
+ raise AssertionError(
+ "invalid value {0} for self._check_mode".format(self._check_mode)
+ )
self._check_mode = c
self.run_env.check_mode_set(c)
return c
@@ -1902,7 +1921,12 @@ class Cmd_nm(Cmd):
name = connection["name"]
if not name:
- assert connection["persistent_state"] == "absent"
+ if not connection["persistent_state"] == "absent":
+ raise AssertionError(
+ "persistent_state must be 'absent' not {0} when there is no connection 'name'".format(
+ connection["persistent_state"]
+ )
+ )
continue
if name in names:
exists = names[name]["nm.exists"]
@@ -1979,7 +2003,7 @@ class Cmd_nm(Cmd):
idx, "ethtool.%s specified but not supported by NM", specified
)
- for option, _ in specified.items():
+ for option in specified.keys():
nm_name = nm_get_name_fcnt(option)
if not nm_name:
self.log_fatal(
diff --git a/module_utils/network_lsr/__init__.py b/module_utils/network_lsr/__init__.py
index 22c717c..e69de29 100644
--- a/module_utils/network_lsr/__init__.py
+++ b/module_utils/network_lsr/__init__.py
@@ -1,7 +0,0 @@
-#!/usr/bin/python3 -tt
-# vim: fileencoding=utf8
-# SPDX-License-Identifier: BSD-3-Clause
-
-
-class MyError(Exception):
- pass
diff --git a/module_utils/network_lsr/argument_validator.py b/module_utils/network_lsr/argument_validator.py
index 24ffdc4..f338489 100644
--- a/module_utils/network_lsr/argument_validator.py
+++ b/module_utils/network_lsr/argument_validator.py
@@ -2,12 +2,16 @@
# vim: fileencoding=utf8
# SPDX-License-Identifier: BSD-3-Clause
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
import posixpath
import socket
import re
# pylint: disable=import-error, no-name-in-module
-from ansible.module_utils.network_lsr import MyError # noqa:E501
+from ansible.module_utils.network_lsr.myerror import MyError # noqa:E501
from ansible.module_utils.network_lsr.utils import Util # noqa:E501
UINT32_MAX = 0xFFFFFFFF
@@ -72,7 +76,8 @@ class ArgUtil:
class ValidationError(MyError):
def __init__(self, name, message):
- Exception.__init__(self, name + ": " + message)
+ # pylint: disable=non-parent-init-called
+ super(ValidationError, self).__init__(name + ": " + message)
self.error_message = message
self.name = name
diff --git a/module_utils/network_lsr/ethtool.py b/module_utils/network_lsr/ethtool.py
index 21e2152..3246bef 100644
--- a/module_utils/network_lsr/ethtool.py
+++ b/module_utils/network_lsr/ethtool.py
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: BSD-3-Clause
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
import array
import struct
import fcntl
@@ -46,7 +50,7 @@ def get_perm_addr(ifname):
res = ecmd.tobytes()
except AttributeError: # tobytes() is not available in python2
res = ecmd.tostring()
- _, size, perm_addr = struct.unpack("II%is" % MAX_ADDR_LEN, res)
+ dummy, size, perm_addr = struct.unpack("II%is" % MAX_ADDR_LEN, res)
perm_addr = Util.mac_ntoa(perm_addr[:size])
except IOError:
perm_addr = None
diff --git a/module_utils/network_lsr/myerror.py b/module_utils/network_lsr/myerror.py
new file mode 100644
index 0000000..f785265
--- /dev/null
+++ b/module_utils/network_lsr/myerror.py
@@ -0,0 +1,11 @@
+#!/usr/bin/python3 -tt
+# vim: fileencoding=utf8
+# SPDX-License-Identifier: BSD-3-Clause
+
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+
+class MyError(Exception):
+ pass
diff --git a/module_utils/network_lsr/nm/__init__.py b/module_utils/network_lsr/nm/__init__.py
index 58fbb5a..74c17cb 100644
--- a/module_utils/network_lsr/nm/__init__.py
+++ b/module_utils/network_lsr/nm/__init__.py
@@ -1,5 +1,9 @@
# Relative import is not support by ansible 2.8 yet
# pylint: disable=import-error, no-name-in-module
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
from ansible.module_utils.network_lsr.nm import provider # noqa:E501
# pylint: enable=import-error, no-name-in-module
diff --git a/module_utils/network_lsr/nm/active_connection.py b/module_utils/network_lsr/nm/active_connection.py
index a6c5a37..432142c 100644
--- a/module_utils/network_lsr/nm/active_connection.py
+++ b/module_utils/network_lsr/nm/active_connection.py
@@ -2,6 +2,10 @@
# Handle NM.ActiveConnection
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
import logging
# Relative import is not support by ansible 2.8 yet
@@ -21,19 +25,15 @@ def deactivate_active_connection(nm_ac, timeout, check_mode):
return False
if not check_mode:
main_loop = client.get_mainloop(timeout)
- logging.debug(
- "Deactivating {id} with timeout {timeout}".format(
- id=nm_ac.get_id(), timeout=timeout
- )
- )
+ logging.debug("Deactivating %s with timeout %s", nm_ac.get_id(), timeout)
user_data = main_loop
handler_id = nm_ac.connect(
NM_AC_STATE_CHANGED_SIGNAL, _nm_ac_state_change_callback, user_data
)
logging.debug(
- "Registered {signal} on client.NM.ActiveConnection {id}".format(
- signal=NM_AC_STATE_CHANGED_SIGNAL, id=nm_ac.get_id()
- )
+ "Registered %s on client.NM.ActiveConnection %s",
+ NM_AC_STATE_CHANGED_SIGNAL,
+ nm_ac.get_id(),
)
if nm_ac.props.state != client.NM.ActiveConnectionState.DEACTIVATING:
nm_client = client.get_client()
@@ -44,9 +44,7 @@ def deactivate_active_connection(nm_ac, timeout, check_mode):
_nm_ac_deactivate_call_back,
user_data,
)
- logging.debug(
- "Deactivating client.NM.ActiveConnection {0}".format(nm_ac.get_id())
- )
+ logging.debug("Deactivating client.NM.ActiveConnection %s", nm_ac.get_id())
main_loop.run()
return True
@@ -56,14 +54,13 @@ def _nm_ac_state_change_callback(nm_ac, state, reason, user_data):
if main_loop.is_cancelled:
return
logging.debug(
- "Got client.NM.ActiveConnection state change: {id}: {state} {reason}".format(
- id=nm_ac.get_id(), state=state, reason=reason
- )
+ "Got client.NM.ActiveConnection state change: %s: %s %s",
+ nm_ac.get_id(),
+ state,
+ reason,
)
if nm_ac.props.state == client.NM.ActiveConnectionState.DEACTIVATED:
- logging.debug(
- "client.NM.ActiveConnection {0} is deactivated".format(nm_ac.get_id())
- )
+ logging.debug("client.NM.ActiveConnection %s is deactivated", nm_ac.get_id())
main_loop.quit()
@@ -82,9 +79,7 @@ def _nm_ac_deactivate_call_back(nm_client, result, user_data):
client.NM.ManagerError.quark(), client.NM.ManagerError.CONNECTIONNOTACTIVE
):
logging.info(
- "Connection is not active on {0}, no need to deactivate".format(
- nm_ac_id
- )
+ "Connection is not active on %s, no need to deactivate", nm_ac_id
)
if nm_ac:
nm_ac.handler_disconnect(handler_id)
diff --git a/module_utils/network_lsr/nm/client.py b/module_utils/network_lsr/nm/client.py
index 4992887..f47cc53 100644
--- a/module_utils/network_lsr/nm/client.py
+++ b/module_utils/network_lsr/nm/client.py
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: BSD-3-Clause
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
import logging
# Relative import is not support by ansible 2.8 yet
diff --git a/module_utils/network_lsr/nm/connection.py b/module_utils/network_lsr/nm/connection.py
index 6982034..474da8d 100644
--- a/module_utils/network_lsr/nm/connection.py
+++ b/module_utils/network_lsr/nm/connection.py
@@ -2,6 +2,10 @@
# Handle NM.RemoteConnection
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
import logging
# Relative import is not support by ansible 2.8 yet
@@ -26,9 +30,10 @@ def delete_remote_connection(nm_profile, timeout, check_mode):
user_data,
)
logging.debug(
- "Deleting profile {id}/{uuid} with timeout {timeout}".format(
- id=nm_profile.get_id(), uuid=nm_profile.get_uuid(), timeout=timeout
- )
+ "Deleting profile %s/%s with timeout %s",
+ nm_profile.get_id(),
+ nm_profile.get_uuid(),
+ timeout,
)
main_loop.run()
return True
@@ -78,9 +83,10 @@ def volatilize_remote_connection(nm_profile, timeout, check_mode):
user_data,
)
logging.debug(
- "Volatilizing profile {id}/{uuid} with timeout {timeout}".format(
- id=nm_profile.get_id(), uuid=nm_profile.get_uuid(), timeout=timeout
- )
+ "Volatilizing profile %s/%s with timeout %s",
+ nm_profile.get_id(),
+ nm_profile.get_uuid(),
+ timeout,
)
main_loop.run()
return True
diff --git a/module_utils/network_lsr/nm/error.py b/module_utils/network_lsr/nm/error.py
index 42014ec..d87bc72 100644
--- a/module_utils/network_lsr/nm/error.py
+++ b/module_utils/network_lsr/nm/error.py
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: BSD-3-Clause
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
class LsrNetworkNmError(Exception):
pass
diff --git a/module_utils/network_lsr/nm/provider.py b/module_utils/network_lsr/nm/provider.py
index 52e7502..567c9d1 100644
--- a/module_utils/network_lsr/nm/provider.py
+++ b/module_utils/network_lsr/nm/provider.py
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: BSD-3-Clause
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
import logging
# Relative import is not support by ansible 2.8 yet
@@ -25,7 +29,7 @@ class NetworkManagerProvider:
nm_ac, timeout, check_mode
)
if not changed:
- logging.info("No active connection for {0}".format(connection_name))
+ logging.info("No active connection for %s", connection_name)
return changed
@@ -49,7 +53,7 @@ class NetworkManagerProvider:
nm_profile, timeout, check_mode
)
if not changed:
- logging.info("No connection with UUID {0} to volatilize".format(uuid))
+ logging.info("No connection with UUID %s to volatilize", uuid)
return changed
diff --git a/module_utils/network_lsr/nm_provider.py b/module_utils/network_lsr/nm_provider.py
index c75242a..d6168eb 100644
--- a/module_utils/network_lsr/nm_provider.py
+++ b/module_utils/network_lsr/nm_provider.py
@@ -1,6 +1,10 @@
# SPDX-License-Identifier: BSD-3-Clause
""" Support for NetworkManager aka the NM provider """
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
# pylint: disable=import-error, no-name-in-module
from ansible.module_utils.network_lsr.utils import Util # noqa:E501
diff --git a/module_utils/network_lsr/utils.py b/module_utils/network_lsr/utils.py
index 73d9528..bc258fe 100644
--- a/module_utils/network_lsr/utils.py
+++ b/module_utils/network_lsr/utils.py
@@ -2,18 +2,23 @@
# SPDX-License-Identifier: BSD-3-Clause
# vim: fileencoding=utf8
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
import socket
import sys
import uuid
# pylint: disable=import-error, no-name-in-module
-from ansible.module_utils.network_lsr import MyError # noqa:E501
+from ansible.module_utils.network_lsr.myerror import MyError # noqa:E501
class Util:
PY3 = sys.version_info[0] == 3
+ # pylint: disable=undefined-variable
STRING_TYPE = str if PY3 else basestring # noqa:F821
@staticmethod
@@ -241,7 +246,8 @@ class Util:
n = int(c, 16) * 16
i = 1
else:
- assert i == 1
+ if not i == 1:
+ raise AssertionError("i != 1 - value is {0}".format(i))
n = n + int(c, 16)
i = 2
b.append(n)
diff --git a/tests/ensure_provider_tests.py b/tests/ensure_provider_tests.py
index 3620729..4e45e6a 100755
--- a/tests/ensure_provider_tests.py
+++ b/tests/ensure_provider_tests.py
@@ -73,8 +73,6 @@ NM_ONLY_TESTS = {
MINIMUM_VERSION: "'1.25.1'",
"comment": "# NetworkManager 1.25.1 introduced ethtool coalesce support",
},
- "playbooks/tests_802_1x_updated.yml": {},
- "playbooks/tests_802_1x.yml": {},
"playbooks/tests_reapply.yml": {},
# team interface is not supported on Fedora
"playbooks/tests_team.yml": {
@@ -117,9 +115,7 @@ def create_nm_playbook(test_playbook):
EXTRA_RUN_CONDITION, ""
)
if extra_run_condition:
- extra_run_condition = "{}{}\n".format(
- EXTRA_RUN_CONDITION_PREFIX, extra_run_condition
- )
+ extra_run_condition = f"{EXTRA_RUN_CONDITION_PREFIX}{extra_run_condition}\n"
nm_version_check = ""
if minimum_nm_version:
@@ -212,7 +208,7 @@ def main():
if missing:
print("ERROR: No NM or initscripts tests found for:\n" + ", \n".join(missing))
- print("Try to generate them with '{} generate'".format(sys.argv[0]))
+ print(f"Try to generate them with '{sys.argv[0]} generate'")
returncode = 1
return returncode
diff --git a/tests/get_coverage.sh b/tests/get_coverage.sh
index 858a8cf..4524fab 100755
--- a/tests/get_coverage.sh
+++ b/tests/get_coverage.sh
@@ -19,7 +19,6 @@ shift
playbook="${1}"
coverage_data="remote-coveragedata-${host}-${playbook%.yml}"
-coverage="/root/.local/bin/coverage"
echo "Getting coverage for ${playbook} on ${host}" >&2
@@ -32,10 +31,15 @@ call_ansible() {
}
remote_coverage_dir="$(mktemp -d /tmp/remote_coverage-XXXXXX)"
+# we want to expand ${remote_coverage_dir} here, so tell SC to be quiet
+# https://github.com/koalaman/shellcheck/wiki/SC2064
+# shellcheck disable=SC2064
trap "rm -rf '${remote_coverage_dir}'" EXIT
ansible-playbook -i "${host}", get_coverage.yml -e "test_playbook=${playbook} destdir=${remote_coverage_dir}"
#COVERAGE_FILE=remote-coverage coverage combine remote-coverage/tests_*/*/root/.coverage
+# https://github.com/koalaman/shellcheck/wiki/SC2046
+# shellcheck disable=SC2046
./merge_coverage.sh coverage "${coverage_data}"-tmp $(find "${remote_coverage_dir}" -type f | tr , _)
cat > tmp_merge_coveragerc <<EOF
diff --git a/tests/get_total_coverage.sh b/tests/get_total_coverage.sh
index ca61746..6413b18 100755
--- a/tests/get_total_coverage.sh
+++ b/tests/get_total_coverage.sh
@@ -12,7 +12,7 @@ then
exit 1
fi
-rm -f remote-coveragedata* "${coveragedata}"
+rm -f remote-coveragedata* "${coverage_data}"
# collect pytest coverage
diff --git a/tests/integration/test_ethernet.py b/tests/integration/test_ethernet.py
index d104d23..4fc7417 100644
--- a/tests/integration/test_ethernet.py
+++ b/tests/integration/test_ethernet.py
@@ -25,10 +25,10 @@ with mock.patch.dict(
class PytestRunEnvironment(nc.RunEnvironment):
def log(self, connections, idx, severity, msg, **kwargs):
if severity == nc.LogLevel.ERROR:
- logging.error("Error: {}".format(connections[idx]))
+ logging.error("Error: %s", connections[idx])
raise RuntimeError(msg)
else:
- logging.debug("Log: {}".format(connections[idx]))
+ logging.debug("Log: %s", connections[idx])
def run_command(self, argv, encoding=None):
command = subprocess.Popen(
diff --git a/tests/merge_coverage.sh b/tests/merge_coverage.sh
index a33e94d..61fcd00 100755
--- a/tests/merge_coverage.sh
+++ b/tests/merge_coverage.sh
@@ -23,6 +23,9 @@ export COVERAGE_FILE="${1}"
shift
tempdir="$(mktemp -d /tmp/coverage_merge-XXXXXX)"
+# we want to expand ${tempdir} here, so tell SC to be quiet
+# https://github.com/koalaman/shellcheck/wiki/SC2064
+# shellcheck disable=SC2064
trap "rm -rf '${tempdir}'" EXIT
cp --backup=numbered -- "${@}" "${tempdir}"
diff --git a/tests/setup_module_utils.sh b/tests/setup_module_utils.sh
deleted file mode 100755
index 18d6a00..0000000
--- a/tests/setup_module_utils.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: MIT
-
-set -euo pipefail
-
-if [ -n "${DEBUG:-}" ] ; then
- set -x
-fi
-
-if [ ! -d "${1:-}" ] ; then
- echo Either ansible is not installed, or there is no ansible/module_utils
- echo in $1 - Skipping
- exit 0
-fi
-
-if [ ! -d "${2:-}" ] ; then
- echo Role has no module_utils - Skipping
- exit 0
-fi
-
-# we need absolute path for $2
-absmoddir=$( readlink -f "$2" )
-
-# clean up old links to module_utils
-for item in "$1"/* ; do
- if lnitem=$( readlink "$item" ) && test -n "$lnitem" ; then
- case "$lnitem" in
- *"${2}"*) rm -f "$item" ;;
- esac
- fi
-done
-
-# add new links to module_utils
-for item in "$absmoddir"/* ; do
- case "$item" in
- *__pycache__) continue;;
- *.pyc) continue;;
- esac
- bnitem=$( basename "$item" )
- ln -s "$item" "$1/$bnitem"
-done
diff --git a/tox.ini b/tox.ini
index 6ff26e7..59c58a2 100644
--- a/tox.ini
+++ b/tox.ini
@@ -17,6 +17,3 @@ setenv =
RUN_PYTEST_EXTRA_ARGS = -v
RUN_FLAKE8_EXTRA_ARGS = --exclude tests/ensure_provider_tests.py,scripts/print_all_options.py,tests/network/ensure_provider_tests.py,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg
LSR_PUBLISH_COVERAGE = normal
-
-[testenv:shellcheck]
-commands = bash -c 'echo shellcheck is currently not enabled - please fix this'
--
2.30.2

35
network-pr353.diff Normal file
View File

@ -0,0 +1,35 @@
From f4fabea55429077c2a4e94fe8015c4ab57f58ff3 Mon Sep 17 00:00:00 2001
From: Fernando Fernandez Mancera <ffmancera@riseup.net>
Date: Mon, 15 Feb 2021 11:02:55 +0100
Subject: [PATCH] README: remove "slaves" leftover from documentation
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 6b15673..06a8b1b 100644
--- a/README.md
+++ b/README.md
@@ -300,7 +300,7 @@ different or the profile may not be tied to an interface at all.
The `zone` option sets the firewalld zone for the interface.
-Slaves to the bridge, bond or team devices cannot specify a zone.
+Ports to the bridge, bond or team devices cannot specify a zone.
### `ip`
@@ -367,7 +367,7 @@ The IP configuration supports the following options:
**Note:** When `route_append_only` or `rule_append_only` is not specified, the `network` role deletes the current routes or routing rules.
-**Note:** Slaves to the bridge, bond or team devices cannot specify `ip` settings.
+**Note:** Ports to the bridge, bond or team devices cannot specify `ip` settings.
### `ethtool`
--
2.29.2

View File

@ -0,0 +1,164 @@
From 9cbbc3f63052bef0b6a697e066e092a5f9722ce8 Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@redhat.com>
Date: Mon, 22 Feb 2021 17:11:05 -0800
Subject: [PATCH] Patch23: selinux-ansible-test-issues.diff
---
.sanity-ansible-ignore-2.10.txt | 2 ++
.sanity-ansible-ignore-2.9.txt | 2 ++
library/selogin.py | 26 ++++++++++-----------
tests/setup_module_utils.sh | 41 ---------------------------------
4 files changed, 16 insertions(+), 55 deletions(-)
create mode 100644 .sanity-ansible-ignore-2.10.txt
create mode 100644 .sanity-ansible-ignore-2.9.txt
delete mode 100755 tests/setup_module_utils.sh
diff --git a/.sanity-ansible-ignore-2.10.txt b/.sanity-ansible-ignore-2.10.txt
new file mode 100644
index 0000000..5f8ce1e
--- /dev/null
+++ b/.sanity-ansible-ignore-2.10.txt
@@ -0,0 +1,2 @@
+plugins/modules/selogin.py no-get-exception
+plugins/modules/selogin.py validate-modules!skip
diff --git a/.sanity-ansible-ignore-2.9.txt b/.sanity-ansible-ignore-2.9.txt
new file mode 100644
index 0000000..5f8ce1e
--- /dev/null
+++ b/.sanity-ansible-ignore-2.9.txt
@@ -0,0 +1,2 @@
+plugins/modules/selogin.py no-get-exception
+plugins/modules/selogin.py validate-modules!skip
diff --git a/library/selogin.py b/library/selogin.py
index b785c27..6e3fd32 100644
--- a/library/selogin.py
+++ b/library/selogin.py
@@ -15,6 +15,9 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
ANSIBLE_METADATA = {
"status": ["preview"],
@@ -22,13 +25,14 @@ ANSIBLE_METADATA = {
"version": "1.0",
}
-DOCUMENTATION = """
+DOCUMENTATION = r"""
---
module: selogin
short_description: Manages linux user to SELinux user mapping
description:
- - Manages linux user to SELinux user mapping
-version_added: "1.0"
+ - "WARNING: Do not use this module directly! It is only for role internal use."
+ - Manages linux user to SELinux user mapping
+version_added: '1.0'
options:
login:
description:
@@ -41,8 +45,7 @@ options:
required: true
default: null
serange:
- description:
- - >-
+ description: >
MLS/MCS Security Range (MLS/MCS Systems only) SELinux Range for SELinux login
mapping - defaults to the SELinux user record range.
required: false
@@ -62,8 +65,9 @@ notes:
- The changes are persistent across reboots
- Not tested on any debian based system
requirements: [ 'libselinux-python', 'policycoreutils-python' ]
-author: Dan Keder
-author: Petr Lautrbach
+author:
+ - Dan Keder (@dkeder)
+ - Petr Lautrbach (@bachradsusi)
"""
EXAMPLES = """
@@ -82,7 +86,7 @@ EXAMPLES = """
# Assign all users in the engineering group to the staff_u user
- selogin:
- login: %engineering
+ login: "%engineering"
seuser: staff_u
state: present
"""
@@ -198,9 +202,6 @@ def semanage_login_add(module, login, seuser, do_reload, serange="s0", sestore="
except KeyError:
e = get_exception()
module.fail_json(msg="%s: %s\n" % (e.__class__.__name__, str(e)))
- except OSError:
- e = get_exception()
- module.fail_json(msg="%s: %s\n" % (e.__class__.__name__, str(e)))
except RuntimeError:
e = get_exception()
module.fail_json(msg="%s: %s\n" % (e.__class__.__name__, str(e)))
@@ -248,9 +249,6 @@ def semanage_login_del(module, login, seuser, do_reload, sestore=""):
except KeyError:
e = get_exception()
module.fail_json(msg="%s: %s\n" % (e.__class__.__name__, str(e)))
- except OSError:
- e = get_exception()
- module.fail_json(msg="%s: %s\n" % (e.__class__.__name__, str(e)))
except RuntimeError:
e = get_exception()
module.fail_json(msg="%s: %s\n" % (e.__class__.__name__, str(e)))
diff --git a/tests/setup_module_utils.sh b/tests/setup_module_utils.sh
deleted file mode 100755
index 94d102d..0000000
--- a/tests/setup_module_utils.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: MIT
-
-set -euo pipefail
-
-if [ -n "${DEBUG:-}" ] ; then
- set -x
-fi
-
-if [ ! -d "${1:-}" ] ; then
- echo Either ansible is not installed, or there is no ansible/module_utils
- echo in "$1" - Skipping
- exit 0
-fi
-
-if [ ! -d "${2:-}" ] ; then
- echo Role has no module_utils - Skipping
- exit 0
-fi
-
-# we need absolute path for $2
-absmoddir=$( readlink -f "$2" )
-
-# clean up old links to module_utils
-for item in "$1"/* ; do
- if lnitem=$( readlink "$item" ) && test -n "$lnitem" ; then
- case "$lnitem" in
- *"${2}"*) rm -f "$item" ;;
- esac
- fi
-done
-
-# add new links to module_utils
-for item in "$absmoddir"/* ; do
- case "$item" in
- *__pycache__) continue;;
- *.pyc) continue;;
- esac
- bnitem=$( basename "$item" )
- ln -s "$item" "$1/$bnitem"
-done
--
2.26.2

3663
storage-ansible-test.diff Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
From b55af45842482768f29704d90a1e019ffe0f7770 Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@redhat.com>
Date: Tue, 2 Mar 2021 13:39:19 -0800
Subject: [PATCH] Patch32: timesync-ansible-test-issues.diff
RHELPLAN-68118 - Collections - Timesync - fixing ansible-test errors
RHELPLAN-68789 - Collections - ignore file for each role
---
.sanity-ansible-ignore-2.9.txt | 1 +
1 file changed, 1 insertion(+)
create mode 100644 .sanity-ansible-ignore-2.9.txt
diff --git a/.sanity-ansible-ignore-2.9.txt b/.sanity-ansible-ignore-2.9.txt
new file mode 100644
index 0000000..e6d5e4d
--- /dev/null
+++ b/.sanity-ansible-ignore-2.9.txt
@@ -0,0 +1 @@
+plugins/modules/timesync_provider.sh shebang
--
2.26.2