rebase roles to latest upstream
rebase roles to latest upstream (1957876) make postfix role idempotent (1960375) use FQRN in postfix README (1958963) use relayhost in postfix README (1866544) use lazy unmount to fix umount: target is busy (1945359) network - Add support for ETHTOOL Ring option (1959649) storage: calltrace observed when set type: partition for storage_pools (1854187) ha_cluster - cannot read preshared key in binary format (1952620) Related: rhbz#1961404
This commit is contained in:
parent
49a2f82370
commit
589f7a04b3
@ -1,28 +0,0 @@
|
|||||||
commit cafd95d0b03360d12e86170eb10fc1fc3dcade06
|
|
||||||
Author: Pavel Cahyna <pcahyna@redhat.com>
|
|
||||||
Date: Thu Jan 14 11:42:48 2021 +0100
|
|
||||||
|
|
||||||
Get rid of the extra final newline in string
|
|
||||||
|
|
||||||
Use the `-` chomping indicator to indicate that the trailing newline is
|
|
||||||
not intended as a part of the string.
|
|
||||||
https://yaml.org/spec/1.1/#chomping/
|
|
||||||
|
|
||||||
The trailing newline was causing an actual problem in the test.
|
|
||||||
|
|
||||||
Also use the `>` folded style, which is more appropriate here than the
|
|
||||||
`|` literal style.
|
|
||||||
|
|
||||||
diff --git a/tests/tests_ssh.yml b/tests/tests_ssh.yml
|
|
||||||
index 6d3699c..d3503f7 100644
|
|
||||||
--- a/tests/tests_ssh.yml
|
|
||||||
+++ b/tests/tests_ssh.yml
|
|
||||||
@@ -27,7 +27,7 @@
|
|
||||||
- include_role:
|
|
||||||
name: linux-system-roles.kdump
|
|
||||||
vars:
|
|
||||||
- kdump_ssh_user: |
|
|
||||||
+ kdump_ssh_user: >-
|
|
||||||
{{ hostvars[kdump_ssh_server_outside]['ansible_user_id'] }}
|
|
||||||
# This is the outside address. Ansible will connect to it to
|
|
||||||
# copy the ssh key.
|
|
@ -1,13 +0,0 @@
|
|||||||
diff --git a/meta/main.yml b/meta/main.yml
|
|
||||||
index 2478fa6..ad8f4c6 100644
|
|
||||||
--- a/meta/main.yml
|
|
||||||
+++ b/meta/main.yml
|
|
||||||
@@ -7,6 +7,6 @@ galaxy_info:
|
|
||||||
min_ansible_version: 2.4
|
|
||||||
platforms:
|
|
||||||
- name: Fedora
|
|
||||||
- versions: [ 27, 28 ]
|
|
||||||
+ versions: [ 31, 32 ]
|
|
||||||
- name: EL
|
|
||||||
- versions: [ 6, 7 ]
|
|
||||||
+ versions: [ 6, 7, 8 ]
|
|
@ -1,142 +0,0 @@
|
|||||||
diff --git a/tests/commonvars.yml b/tests/commonvars.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..2cd3566
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/commonvars.yml
|
|
||||||
@@ -0,0 +1,2 @@
|
|
||||||
+restore_services:
|
|
||||||
+ - kdump
|
|
||||||
diff --git a/tests/get_services_state.yml b/tests/get_services_state.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..4fe5d36
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/get_services_state.yml
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+- name: Get initial state of services
|
|
||||||
+ tags: tests::cleanup
|
|
||||||
+ service_facts:
|
|
||||||
+ register: initial_state
|
|
||||||
diff --git a/tests/restore_services_state.yml b/tests/restore_services_state.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..2035dfc
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/restore_services_state.yml
|
|
||||||
@@ -0,0 +1,22 @@
|
|
||||||
+- block:
|
|
||||||
+ - name: load common vars
|
|
||||||
+ include_vars:
|
|
||||||
+ file: commonvars.yml
|
|
||||||
+
|
|
||||||
+ - name: Get final state of services
|
|
||||||
+ service_facts:
|
|
||||||
+ register: final_state
|
|
||||||
+
|
|
||||||
+ - name: Restore state of services
|
|
||||||
+ service:
|
|
||||||
+ name: "{{ item }}"
|
|
||||||
+ state: "{{ 'started' if
|
|
||||||
+ initial_state.ansible_facts.services[sname]['state']
|
|
||||||
+ == 'running' else 'stopped' }}"
|
|
||||||
+ when:
|
|
||||||
+ - sname in final_state.ansible_facts.services
|
|
||||||
+ - sname in initial_state.ansible_facts.services
|
|
||||||
+ vars:
|
|
||||||
+ sname: "{{ item + '.service' }}"
|
|
||||||
+ with_items: "{{ restore_services }}"
|
|
||||||
+ tags: tests::cleanup
|
|
||||||
diff --git a/tests/tests_default.yml b/tests/tests_default.yml
|
|
||||||
index af0b2a0..6ce5241 100644
|
|
||||||
--- a/tests/tests_default.yml
|
|
||||||
+++ b/tests/tests_default.yml
|
|
||||||
@@ -3,3 +3,13 @@
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- linux-system-roles.kdump
|
|
||||||
+
|
|
||||||
+ pre_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
+ post_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
diff --git a/tests/tests_default_wrapper.yml b/tests/tests_default_wrapper.yml
|
|
||||||
index eba31a0..857aab8 100644
|
|
||||||
--- a/tests/tests_default_wrapper.yml
|
|
||||||
+++ b/tests/tests_default_wrapper.yml
|
|
||||||
@@ -1,6 +1,9 @@
|
|
||||||
---
|
|
||||||
- name: Create static inventory from hostvars
|
|
||||||
hosts: all
|
|
||||||
+ tags:
|
|
||||||
+# - 'tests::tier1'
|
|
||||||
+ - 'tests::slow'
|
|
||||||
tasks:
|
|
||||||
- name: create temporary file
|
|
||||||
tempfile:
|
|
||||||
@@ -17,10 +20,16 @@
|
|
||||||
|
|
||||||
|
|
||||||
- name: Run tests_default.yml normally
|
|
||||||
+ tags:
|
|
||||||
+# - 'tests::tier1'
|
|
||||||
+ - 'tests::slow'
|
|
||||||
import_playbook: tests_default.yml
|
|
||||||
|
|
||||||
- name: Run tests_default.yml in check_mode
|
|
||||||
hosts: all
|
|
||||||
+ tags:
|
|
||||||
+# - 'tests::tier1'
|
|
||||||
+ - 'tests::slow'
|
|
||||||
tasks:
|
|
||||||
- name: Run ansible-playbook with tests_default.yml in check mode
|
|
||||||
command: >
|
|
||||||
diff --git a/tests/tests_ssh.yml b/tests/tests_ssh.yml
|
|
||||||
index d12e884..6d3699c 100644
|
|
||||||
--- a/tests/tests_ssh.yml
|
|
||||||
+++ b/tests/tests_ssh.yml
|
|
||||||
@@ -10,6 +10,13 @@
|
|
||||||
# this is the address at which the ssh dump server can be reached
|
|
||||||
# from the managed host. Dumps will be uploaded there.
|
|
||||||
kdump_ssh_server_inside: "{{ kdump_ssh_source if kdump_ssh_source in hostvars[kdump_ssh_server_outside]['ansible_all_ipv4_addresses'] + hostvars[kdump_ssh_server_outside]['ansible_all_ipv6_addresses'] else hostvars[kdump_ssh_server_outside]['ansible_default_ipv4']['address'] }}"
|
|
||||||
+ tags:
|
|
||||||
+ # this test executes some tasks on localhost and relies on
|
|
||||||
+ # localhost being a different host than the managed host
|
|
||||||
+ # (localhost is being used as a second host in multihost
|
|
||||||
+ # scenario). This also means that localhost must be capable
|
|
||||||
+ # enough (not just a container - must be runnign a sshd).
|
|
||||||
+ - 'tests::multihost_localhost'
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- name: gather facts from {{ kdump_ssh_server_outside }}
|
|
||||||
diff --git a/tests/tests_ssh_wrapper.yml b/tests/tests_ssh_wrapper.yml
|
|
||||||
index 2203f3f..96a764e 100644
|
|
||||||
--- a/tests/tests_ssh_wrapper.yml
|
|
||||||
+++ b/tests/tests_ssh_wrapper.yml
|
|
||||||
@@ -1,6 +1,8 @@
|
|
||||||
---
|
|
||||||
- name: Create static inventory from hostvars
|
|
||||||
hosts: all
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::slow'
|
|
||||||
tasks:
|
|
||||||
- name: create temporary file
|
|
||||||
tempfile:
|
|
||||||
@@ -17,10 +19,15 @@
|
|
||||||
|
|
||||||
|
|
||||||
- name: Run tests_ssh.yml normally
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::slow'
|
|
||||||
import_playbook: tests_ssh.yml
|
|
||||||
|
|
||||||
- name: Run tests_ssh.yml in check_mode
|
|
||||||
hosts: all
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::slow'
|
|
||||||
+ - 'tests::multihost_localhost'
|
|
||||||
tasks:
|
|
||||||
- name: Run ansible-playbook with tests_ssh.yml in check mode
|
|
||||||
command: |
|
|
@ -13,8 +13,8 @@ Name: linux-system-roles
|
|||||||
%endif
|
%endif
|
||||||
Url: https://github.com/linux-system-roles/
|
Url: https://github.com/linux-system-roles/
|
||||||
Summary: Set of interfaces for unified system management
|
Summary: Set of interfaces for unified system management
|
||||||
Version: 1.1.0
|
Version: 1.2.0
|
||||||
Release: 2%{?dist}
|
Release: 1%{?dist}
|
||||||
|
|
||||||
#Group: Development/Libraries
|
#Group: Development/Libraries
|
||||||
License: GPLv3+ and MIT and BSD
|
License: GPLv3+ and MIT and BSD
|
||||||
@ -97,73 +97,73 @@ BuildRequires: ansible >= 2.9.10
|
|||||||
%%global rolestodir %%{?rolestodir} %%{roletodir%{1}}
|
%%global rolestodir %%{?rolestodir} %%{roletodir%{1}}
|
||||||
}
|
}
|
||||||
|
|
||||||
%defcommit 1 bbf5784849d362cc3443fde8b09da26ea698a8ce
|
%defcommit 1 6704b330fc3e6220ab4c00268d4c972b7c042886
|
||||||
%global rolename1 postfix
|
%global rolename1 postfix
|
||||||
#%%deftag 1 0.1
|
#%%deftag 1 0.1
|
||||||
|
|
||||||
%defcommit 2 557546f922886fc1e73012f2af08ec80fec82fe2
|
%defcommit 2 62ff85a9c605a7c281d4dfb5a047f322245c63b5
|
||||||
%global rolename2 selinux
|
%global rolename2 selinux
|
||||||
#%%deftag 2 1.1.1
|
#%%deftag 2 1.1.1
|
||||||
|
|
||||||
%defcommit 3 8a95989e158519ce4bebe10091c47ef88b29261b
|
%defcommit 3 3f69039d5ff986a74ed76bc4419da7b2efb2992a
|
||||||
%global rolename3 timesync
|
%global rolename3 timesync
|
||||||
#%%deftag 3 1.0.0
|
#%%deftag 3 1.0.0
|
||||||
|
|
||||||
%defcommit 4 77596fdd976c6160d6152c200a5432c609725a14
|
%defcommit 4 8243bd4315463a9d6022da5edd65dbc051a7d496
|
||||||
%global rolename4 kdump
|
%global rolename4 kdump
|
||||||
#%%deftag 4 1.0.0
|
#%%deftag 4 1.0.0
|
||||||
|
|
||||||
%defcommit 5 0f5a882bcab58baba527015b7cde01c7c52d2254
|
%defcommit 5 ae2d60a0b204f4a7ba1f27696f11d950dd882fda
|
||||||
%global rolename5 network
|
%global rolename5 network
|
||||||
#%%deftag 5 1.0.0
|
#%%deftag 5 1.0.0
|
||||||
|
|
||||||
%defcommit 6 2c3eeb8b2dd898d8c589a0740c2ba9b707e4ed2c
|
%defcommit 6 b3b456183edb7b8aa6ceff7ce667d8e22009ef6a
|
||||||
%global rolename6 storage
|
%global rolename6 storage
|
||||||
#%%deftag 6 1.2.2
|
#%%deftag 6 1.2.2
|
||||||
|
|
||||||
%defcommit 7 c9b2ee085ccc741b5a9fa8a4b2a7a2f8c8551579
|
%defcommit 7 384718b020c50ae274230e9dc59fc11620e03537
|
||||||
%global rolename7 metrics
|
%global rolename7 metrics
|
||||||
#%%deftag 7 0.1.0
|
#%%deftag 7 0.1.0
|
||||||
|
|
||||||
%defcommit 8 103d3996436c98dccf89e645378e76bd9add2abb
|
%defcommit 8 2b9e53233ee3a68bdb532e62f289733e436a6106
|
||||||
%global rolename8 tlog
|
%global rolename8 tlog
|
||||||
#%%deftag 8 1.1.0
|
#%%deftag 8 1.1.0
|
||||||
|
|
||||||
%defcommit 9 a8ab76f8076078763dacacf3384315c86b342d52
|
%defcommit 9 9373303b98e09ef38df7afc8d06e5e55812096c7
|
||||||
%global rolename9 kernel_settings
|
%global rolename9 kernel_settings
|
||||||
#%%deftag 9 1.0.1
|
#%%deftag 9 1.0.1
|
||||||
|
|
||||||
%defcommit 10 07e08107e7ccba5822f8a7aaec1a2ff0a221bede
|
%defcommit 10 c3e5b03801a43e746961646ef0bea1b93a22c234
|
||||||
%global rolename10 logging
|
%global rolename10 logging
|
||||||
#%%deftag 10 0.2.0
|
#%%deftag 10 0.2.0
|
||||||
|
|
||||||
%defcommit 11 4dfc5e2aca74cb82f2a50eec7e975a2b78ad9678
|
%defcommit 11 c57d0b1f3384c525738fa26ba4bdca485e162567
|
||||||
%global rolename11 nbde_server
|
%global rolename11 nbde_server
|
||||||
#%%deftag 11 1.0.1
|
#%%deftag 11 1.0.1
|
||||||
|
|
||||||
%defcommit 12 19f06159582550c8463f7d8492669e26fbdf760b
|
%defcommit 12 bef2fad5e365712d1f40e53662490ba2550a253f
|
||||||
%global rolename12 nbde_client
|
%global rolename12 nbde_client
|
||||||
#%%deftag 12 1.0.1
|
#%%deftag 12 1.0.1
|
||||||
|
|
||||||
%defcommit 13 23f1a414ab022a506614c5be8eadf1708dc45b2b
|
%defcommit 13 310fc53db04e8d3134524afb7a89b0477a2ffb83
|
||||||
%global rolename13 certificate
|
%global rolename13 certificate
|
||||||
#%%deftag 13 1.0.1
|
#%%deftag 13 1.0.1
|
||||||
|
|
||||||
%defcommit 14 ff335b87017954c0b47bfe818700e0f1600b04db
|
%defcommit 14 b2a9857ac661fa32e66666e444b73bfdb34cdf95
|
||||||
%global rolename14 crypto_policies
|
%global rolename14 crypto_policies
|
||||||
|
|
||||||
%global forgeorg15 https://github.com/willshersystems/
|
%global forgeorg15 https://github.com/willshersystems/
|
||||||
%global repo15 ansible-sshd
|
%global repo15 ansible-sshd
|
||||||
%global rolename15 sshd
|
%global rolename15 sshd
|
||||||
%defcommit 15 428d390668077f0baf5e88c5834ee810ae11113c
|
%defcommit 15 32f9d0dda5a801cbefad09214ec2d88b6838b943
|
||||||
|
|
||||||
%defcommit 16 54bec0855966cc3eed65b26a7c90962eb103d66d
|
%defcommit 16 59b9fd7b25607d8bd33bdb082748955f2652846a
|
||||||
%global rolename16 ssh
|
%global rolename16 ssh
|
||||||
|
|
||||||
%defcommit 17 d97f48a21002497e1ac1bd1385841f2939d7b840
|
%defcommit 17 6e1e37f0097db23c8b804e520e272575e9714d5f
|
||||||
%global rolename17 ha_cluster
|
%global rolename17 ha_cluster
|
||||||
|
|
||||||
%defcommit 18 73e8f5e3b514a8e7a3637dc204d5c106adddeea7
|
%defcommit 18 5f6cb73e6753fbdbb219b7d3079f0378b2d3bdb3
|
||||||
%global rolename18 vpn
|
%global rolename18 vpn
|
||||||
|
|
||||||
%global mainid 7d093179c3b649f4375ed67f8edd8fca87f0ba1f
|
%global mainid 7d093179c3b649f4375ed67f8edd8fca87f0ba1f
|
||||||
@ -191,22 +191,8 @@ Source18: %{archiveurl18}
|
|||||||
# Not used on Fedora.
|
# Not used on Fedora.
|
||||||
Source998: collection_readme.sh
|
Source998: collection_readme.sh
|
||||||
|
|
||||||
Patch21: selinux-tier1-tags.diff
|
Patch51: network-tier1-tags.diff
|
||||||
|
Patch52: network-disable-bondtests.diff
|
||||||
Patch31: timesync-tier1-tags.diff
|
|
||||||
|
|
||||||
Patch41: rhel-system-roles-kdump-pr22.diff
|
|
||||||
Patch42: kdump-tier1-tags.diff
|
|
||||||
Patch43: kdump-meta-el8.diff
|
|
||||||
Patch44: kdump-fix-newline.diff
|
|
||||||
|
|
||||||
Patch51: network-epel-minimal.diff
|
|
||||||
# Not suitable for upstream, since the files need to be executable there
|
|
||||||
Patch52: network-tier1-tags.diff
|
|
||||||
Patch53: network-disable-bondtests.diff
|
|
||||||
Patch54: network-ansible-test.diff
|
|
||||||
|
|
||||||
Patch61: storage-ansible-test.diff
|
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
@ -259,26 +245,9 @@ for rolename in %{rolenames}; do
|
|||||||
mv "${ROLESTODIR[${rolename}]}" ${rolename}
|
mv "${ROLESTODIR[${rolename}]}" ${rolename}
|
||||||
done
|
done
|
||||||
|
|
||||||
cd %{rolename2}
|
|
||||||
%patch21 -p1
|
|
||||||
cd ..
|
|
||||||
cd %{rolename3}
|
|
||||||
%patch31 -p1
|
|
||||||
cd ..
|
|
||||||
cd %{rolename4}
|
|
||||||
%patch41 -p1
|
|
||||||
%patch42 -p1
|
|
||||||
%patch43 -p1
|
|
||||||
%patch44 -p1
|
|
||||||
cd ..
|
|
||||||
cd %{rolename5}
|
cd %{rolename5}
|
||||||
%patch51 -p1
|
%patch51 -p1
|
||||||
%patch52 -p1
|
%patch52 -p1
|
||||||
%patch53 -p1
|
|
||||||
%patch54 -p1
|
|
||||||
cd ..
|
|
||||||
cd %{rolename6}
|
|
||||||
%patch61 -p1
|
|
||||||
cd ..
|
cd ..
|
||||||
cd %{rolename15}
|
cd %{rolename15}
|
||||||
sed -r -i -e "s/ansible-sshd/linux-system-roles.sshd/" tests/*.yml examples/*.yml
|
sed -r -i -e "s/ansible-sshd/linux-system-roles.sshd/" tests/*.yml examples/*.yml
|
||||||
@ -569,6 +538,24 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri May 14 2021 Rich Megginson <rmeggins@redhat.com> - 1.2.0-1
|
||||||
|
- rebase roles to latest upstream
|
||||||
|
Resolves rhbz#1957876
|
||||||
|
- make postfix role idempotent
|
||||||
|
Resolves rhbz#1960375
|
||||||
|
- use FQRN in postfix README
|
||||||
|
Resolves rhbz#1958963
|
||||||
|
- use relayhost in postfix README
|
||||||
|
Resolves rhbz#1866544
|
||||||
|
- use lazy unmount to fix umount: target is busy
|
||||||
|
Resolves rhbz#1945359
|
||||||
|
- network - Add support for ETHTOOL Ring option
|
||||||
|
Resolves rhbz#1959649
|
||||||
|
- storage: calltrace observed when set type: partition for storage_pools
|
||||||
|
Resolves rhbz#1854187
|
||||||
|
- ha_cluster - cannot read preshared key in binary format
|
||||||
|
Resolves rhbz#1952620
|
||||||
|
|
||||||
* Thu May 13 2021 Noriko Hosoi <nhosoi@redhat.com> - 1.1.0-2
|
* Thu May 13 2021 Noriko Hosoi <nhosoi@redhat.com> - 1.1.0-2
|
||||||
- Dependencies in the collection packaging
|
- Dependencies in the collection packaging
|
||||||
Resolves rhbz#1954747
|
Resolves rhbz#1954747
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: "{{ target }}"
|
|
||||||
vars:
|
|
||||||
timesync_ntp_servers:
|
|
||||||
- hostname: 0.pool.ntp.org
|
|
||||||
iburst: yes
|
|
||||||
- hostname: 1.pool.ntp.org
|
|
||||||
iburst: yes
|
|
||||||
- hostname: 2.pool.ntp.org
|
|
||||||
iburst: yes
|
|
||||||
- hostname: 3.pool.ntp.org
|
|
||||||
iburst: yes
|
|
||||||
roles:
|
|
||||||
- linux-system-roles.timesync
|
|
@ -1,813 +0,0 @@
|
|||||||
From c0297506cee0d615f44e52b7c826cd83916eba08 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Rich Megginson <rmeggins@redhat.com>
|
|
||||||
Date: Thu, 25 Mar 2021 13:58:03 -0600
|
|
||||||
Subject: [PATCH 4/4] Patch54: network-ansible-test.diff
|
|
||||||
|
|
||||||
---
|
|
||||||
.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 06a8b1b..48bb5bc 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 profile’s 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 dc30ae8..32ebec9 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()
|
|
||||||
@@ -1399,7 +1407,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
|
|
||||||
@@ -1408,7 +1416,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)
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1470,7 +1479,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:
|
|
||||||
@@ -1607,14 +1617,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
|
|
||||||
|
|
||||||
@@ -1623,11 +1634,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
|
|
||||||
@@ -1697,7 +1711,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)
|
|
||||||
@@ -1745,7 +1762,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
|
|
||||||
@@ -1911,7 +1930,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"]
|
|
||||||
@@ -1988,7 +2012,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 1bfaeda..a6ed937 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 078e99d..c22dbce 100755
|
|
||||||
--- a/tests/ensure_provider_tests.py
|
|
||||||
+++ b/tests/ensure_provider_tests.py
|
|
||||||
@@ -76,8 +76,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": {
|
|
||||||
@@ -122,9 +120,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:
|
|
||||||
@@ -217,7 +213,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
|
|
||||||
|
|
@ -1,443 +0,0 @@
|
|||||||
From 88189e32ab6ab4491430584e8c162c9c42d6ca47 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Rich Megginson <rmeggins@redhat.com>
|
|
||||||
Date: Thu, 25 Mar 2021 13:55:01 -0600
|
|
||||||
Subject: [PATCH 1/4] Patch51: network-epel-minimal.diff
|
|
||||||
|
|
||||||
---
|
|
||||||
.../playbooks/integration_pytest_python3.yml | 5 ++++
|
|
||||||
tests/tasks/el_repo_setup.yml | 26 -------------------
|
|
||||||
tests/tasks/setup_802_1x_server.yml | 2 ++
|
|
||||||
tests/tasks/setup_mock_wifi.yml | 2 ++
|
|
||||||
tests/tests_802_1x_nm.yml | 1 -
|
|
||||||
tests/tests_802_1x_updated_nm.yml | 1 -
|
|
||||||
tests/tests_bond_deprecated_initscripts.yml | 1 -
|
|
||||||
tests/tests_bond_initscripts.yml | 1 -
|
|
||||||
tests/tests_bond_nm.yml | 1 -
|
|
||||||
tests/tests_bridge_initscripts.yml | 1 -
|
|
||||||
tests/tests_bridge_nm.yml | 1 -
|
|
||||||
tests/tests_default.yml | 1 -
|
|
||||||
tests/tests_default_initscripts.yml | 1 -
|
|
||||||
tests/tests_default_nm.yml | 1 -
|
|
||||||
tests/tests_ethernet_initscripts.yml | 2 --
|
|
||||||
tests/tests_ethernet_nm.yml | 2 --
|
|
||||||
tests/tests_ethtool_features_initscripts.yml | 1 -
|
|
||||||
tests/tests_ethtool_features_nm.yml | 2 --
|
|
||||||
tests/tests_helpers_and_asserts.yml | 2 --
|
|
||||||
tests/tests_integration_pytest.yml | 5 ++--
|
|
||||||
tests/tests_provider_nm.yml | 2 --
|
|
||||||
tests/tests_reapply_nm.yml | 2 --
|
|
||||||
tests/tests_regression_nm.yml | 2 --
|
|
||||||
tests/tests_states_initscripts.yml | 2 --
|
|
||||||
tests/tests_states_nm.yml | 2 --
|
|
||||||
tests/tests_team_nm.yml | 2 --
|
|
||||||
tests/tests_unit.yml | 2 +-
|
|
||||||
tests/tests_vlan_mtu_initscripts.yml | 2 --
|
|
||||||
tests/tests_vlan_mtu_nm.yml | 2 --
|
|
||||||
tests/tests_wireless_nm.yml | 2 --
|
|
||||||
30 files changed, 12 insertions(+), 67 deletions(-)
|
|
||||||
delete mode 100644 tests/tasks/el_repo_setup.yml
|
|
||||||
|
|
||||||
diff --git a/tests/playbooks/integration_pytest_python3.yml b/tests/playbooks/integration_pytest_python3.yml
|
|
||||||
index 075355b..5fc9dea 100644
|
|
||||||
--- a/tests/playbooks/integration_pytest_python3.yml
|
|
||||||
+++ b/tests/playbooks/integration_pytest_python3.yml
|
|
||||||
@@ -9,6 +9,11 @@
|
|
||||||
- rsync
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
+ - name: Install EPEL for RHEL and CentOS
|
|
||||||
+ # yamllint disable-line rule:line-length
|
|
||||||
+ command: "yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm"
|
|
||||||
+ when: ansible_distribution in ["CentOS", "RedHat"]
|
|
||||||
+
|
|
||||||
- name: Install rpm dependencies
|
|
||||||
package:
|
|
||||||
state: present
|
|
||||||
diff --git a/tests/tasks/el_repo_setup.yml b/tests/tasks/el_repo_setup.yml
|
|
||||||
deleted file mode 100644
|
|
||||||
index 0656e8c..0000000
|
|
||||||
--- a/tests/tasks/el_repo_setup.yml
|
|
||||||
+++ /dev/null
|
|
||||||
@@ -1,26 +0,0 @@
|
|
||||||
-# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
-- name: Fix CentOS6 Base repo
|
|
||||||
- copy:
|
|
||||||
- dest: /etc/yum.repos.d/CentOS-Base.repo
|
|
||||||
- content: |
|
|
||||||
- [base]
|
|
||||||
- name=CentOS-$releasever - Base
|
|
||||||
- baseurl=https://vault.centos.org/6.10/os/$basearch/
|
|
||||||
- gpgcheck=1
|
|
||||||
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
|
||||||
-
|
|
||||||
- [updates]
|
|
||||||
- name=CentOS-$releasever - Updates
|
|
||||||
- baseurl=https://vault.centos.org/6.10/updates/$basearch/
|
|
||||||
- gpgcheck=1
|
|
||||||
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
|
||||||
-
|
|
||||||
- [extras]
|
|
||||||
- name=CentOS-$releasever - Extras
|
|
||||||
- baseurl=https://vault.centos.org/6.10/extras/$basearch/
|
|
||||||
- gpgcheck=1
|
|
||||||
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
|
||||||
- when:
|
|
||||||
- - ansible_distribution == 'CentOS'
|
|
||||||
- - ansible_distribution_major_version == '6'
|
|
||||||
-- include_tasks: enable_epel.yml
|
|
||||||
diff --git a/tests/tasks/setup_802_1x_server.yml b/tests/tasks/setup_802_1x_server.yml
|
|
||||||
index 49d1ce1..3bf16a9 100644
|
|
||||||
--- a/tests/tasks/setup_802_1x_server.yml
|
|
||||||
+++ b/tests/tasks/setup_802_1x_server.yml
|
|
||||||
@@ -1,5 +1,7 @@
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
---
|
|
||||||
+- include_tasks: enable_epel.yml
|
|
||||||
+
|
|
||||||
- name: Install hostapd
|
|
||||||
package:
|
|
||||||
name: hostapd
|
|
||||||
diff --git a/tests/tasks/setup_mock_wifi.yml b/tests/tasks/setup_mock_wifi.yml
|
|
||||||
index 997b704..d7a1e22 100644
|
|
||||||
--- a/tests/tasks/setup_mock_wifi.yml
|
|
||||||
+++ b/tests/tasks/setup_mock_wifi.yml
|
|
||||||
@@ -1,5 +1,7 @@
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
---
|
|
||||||
+- include_tasks: enable_epel.yml
|
|
||||||
+
|
|
||||||
- name: Install packages required to set up mock wifi network
|
|
||||||
package:
|
|
||||||
name:
|
|
||||||
diff --git a/tests/tests_802_1x_nm.yml b/tests/tests_802_1x_nm.yml
|
|
||||||
index a27d8ea..288cd5d 100644
|
|
||||||
--- a/tests/tests_802_1x_nm.yml
|
|
||||||
+++ b/tests/tests_802_1x_nm.yml
|
|
||||||
@@ -5,7 +5,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_802_1x.yml' with nm as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_802_1x_updated_nm.yml b/tests/tests_802_1x_updated_nm.yml
|
|
||||||
index 5a25f5b..bd335e4 100644
|
|
||||||
--- a/tests/tests_802_1x_updated_nm.yml
|
|
||||||
+++ b/tests/tests_802_1x_updated_nm.yml
|
|
||||||
@@ -5,7 +5,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_802_1x_updated.yml' with nm as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_bond_deprecated_initscripts.yml b/tests/tests_bond_deprecated_initscripts.yml
|
|
||||||
index 1e74bcc..383b488 100644
|
|
||||||
--- a/tests/tests_bond_deprecated_initscripts.yml
|
|
||||||
+++ b/tests/tests_bond_deprecated_initscripts.yml
|
|
||||||
@@ -4,7 +4,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_bond_deprecated.yml' with initscripts
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
- name: Set network provider to 'initscripts'
|
|
||||||
set_fact:
|
|
||||||
network_provider: initscripts
|
|
||||||
diff --git a/tests/tests_bond_initscripts.yml b/tests/tests_bond_initscripts.yml
|
|
||||||
index 32fcc32..8fa74c5 100644
|
|
||||||
--- a/tests/tests_bond_initscripts.yml
|
|
||||||
+++ b/tests/tests_bond_initscripts.yml
|
|
||||||
@@ -4,7 +4,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_bond.yml' with initscripts as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
- name: Set network provider to 'initscripts'
|
|
||||||
set_fact:
|
|
||||||
network_provider: initscripts
|
|
||||||
diff --git a/tests/tests_bond_nm.yml b/tests/tests_bond_nm.yml
|
|
||||||
index 7075d95..8ac6cbd 100644
|
|
||||||
--- a/tests/tests_bond_nm.yml
|
|
||||||
+++ b/tests/tests_bond_nm.yml
|
|
||||||
@@ -5,7 +5,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_bond.yml' with nm as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_bridge_initscripts.yml b/tests/tests_bridge_initscripts.yml
|
|
||||||
index 8ce42e6..db5663c 100644
|
|
||||||
--- a/tests/tests_bridge_initscripts.yml
|
|
||||||
+++ b/tests/tests_bridge_initscripts.yml
|
|
||||||
@@ -4,7 +4,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_bridge.yml' with initscripts as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
- name: Set network provider to 'initscripts'
|
|
||||||
set_fact:
|
|
||||||
network_provider: initscripts
|
|
||||||
diff --git a/tests/tests_bridge_nm.yml b/tests/tests_bridge_nm.yml
|
|
||||||
index 3d1b53a..c565952 100644
|
|
||||||
--- a/tests/tests_bridge_nm.yml
|
|
||||||
+++ b/tests/tests_bridge_nm.yml
|
|
||||||
@@ -5,7 +5,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_bridge.yml' with nm as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_default.yml b/tests/tests_default.yml
|
|
||||||
index e196314..f6f7550 100644
|
|
||||||
--- a/tests/tests_default.yml
|
|
||||||
+++ b/tests/tests_default.yml
|
|
||||||
@@ -5,7 +5,6 @@
|
|
||||||
roles:
|
|
||||||
- linux-system-roles.network
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
- name: Test warning and info logs
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
diff --git a/tests/tests_default_initscripts.yml b/tests/tests_default_initscripts.yml
|
|
||||||
index 006889c..cc8b875 100644
|
|
||||||
--- a/tests/tests_default_initscripts.yml
|
|
||||||
+++ b/tests/tests_default_initscripts.yml
|
|
||||||
@@ -2,7 +2,6 @@
|
|
||||||
---
|
|
||||||
- hosts: all
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
- name: Set network provider to 'initscripts'
|
|
||||||
set_fact:
|
|
||||||
network_provider: initscripts
|
|
||||||
diff --git a/tests/tests_default_nm.yml b/tests/tests_default_nm.yml
|
|
||||||
index 54bc3e1..8138ca9 100644
|
|
||||||
--- a/tests/tests_default_nm.yml
|
|
||||||
+++ b/tests/tests_default_nm.yml
|
|
||||||
@@ -2,7 +2,6 @@
|
|
||||||
---
|
|
||||||
- hosts: all
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_ethernet_initscripts.yml b/tests/tests_ethernet_initscripts.yml
|
|
||||||
index 366b052..62e75fe 100644
|
|
||||||
--- a/tests/tests_ethernet_initscripts.yml
|
|
||||||
+++ b/tests/tests_ethernet_initscripts.yml
|
|
||||||
@@ -4,8 +4,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_ethernet.yml' with initscripts as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: Set network provider to 'initscripts'
|
|
||||||
set_fact:
|
|
||||||
network_provider: initscripts
|
|
||||||
diff --git a/tests/tests_ethernet_nm.yml b/tests/tests_ethernet_nm.yml
|
|
||||||
index 238172d..ecefa14 100644
|
|
||||||
--- a/tests/tests_ethernet_nm.yml
|
|
||||||
+++ b/tests/tests_ethernet_nm.yml
|
|
||||||
@@ -5,8 +5,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_ethernet.yml' with nm as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_ethtool_features_initscripts.yml b/tests/tests_ethtool_features_initscripts.yml
|
|
||||||
index 5bac5d3..6aea73b 100644
|
|
||||||
--- a/tests/tests_ethtool_features_initscripts.yml
|
|
||||||
+++ b/tests/tests_ethtool_features_initscripts.yml
|
|
||||||
@@ -2,7 +2,6 @@
|
|
||||||
# set network provider and gather facts
|
|
||||||
- hosts: all
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
- name: Set network provider to 'initscripts'
|
|
||||||
set_fact:
|
|
||||||
network_provider: initscripts
|
|
||||||
diff --git a/tests/tests_ethtool_features_nm.yml b/tests/tests_ethtool_features_nm.yml
|
|
||||||
index 2027862..30c6faa 100644
|
|
||||||
--- a/tests/tests_ethtool_features_nm.yml
|
|
||||||
+++ b/tests/tests_ethtool_features_nm.yml
|
|
||||||
@@ -5,8 +5,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_ethtool_features.yml' with nm as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_helpers_and_asserts.yml b/tests/tests_helpers_and_asserts.yml
|
|
||||||
index 64e2875..5514182 100644
|
|
||||||
--- a/tests/tests_helpers_and_asserts.yml
|
|
||||||
+++ b/tests/tests_helpers_and_asserts.yml
|
|
||||||
@@ -3,8 +3,6 @@
|
|
||||||
- name: Check that creating and removing test devices and assertions work
|
|
||||||
hosts: all
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: test veth interface management
|
|
||||||
include_tasks: tasks/create_and_remove_interface.yml
|
|
||||||
vars:
|
|
||||||
diff --git a/tests/tests_integration_pytest.yml b/tests/tests_integration_pytest.yml
|
|
||||||
index 9b80bd4..153214d 100644
|
|
||||||
--- a/tests/tests_integration_pytest.yml
|
|
||||||
+++ b/tests/tests_integration_pytest.yml
|
|
||||||
@@ -1,8 +1,7 @@
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
---
|
|
||||||
-- hosts: all
|
|
||||||
- tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
+- name: Empty play to gather facts
|
|
||||||
+ hosts: all
|
|
||||||
|
|
||||||
- import_playbook: playbooks/integration_pytest_python3.yml
|
|
||||||
when: (ansible_distribution in ["CentOS", "RedHat"] and
|
|
||||||
diff --git a/tests/tests_provider_nm.yml b/tests/tests_provider_nm.yml
|
|
||||||
index 67fcffe..99306a1 100644
|
|
||||||
--- a/tests/tests_provider_nm.yml
|
|
||||||
+++ b/tests/tests_provider_nm.yml
|
|
||||||
@@ -5,8 +5,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_provider.yml' with nm as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_reapply_nm.yml b/tests/tests_reapply_nm.yml
|
|
||||||
index eb48ddb..69fb208 100644
|
|
||||||
--- a/tests/tests_reapply_nm.yml
|
|
||||||
+++ b/tests/tests_reapply_nm.yml
|
|
||||||
@@ -5,8 +5,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_reapply.yml' with nm as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_regression_nm.yml b/tests/tests_regression_nm.yml
|
|
||||||
index b2c46e9..9eb8084 100644
|
|
||||||
--- a/tests/tests_regression_nm.yml
|
|
||||||
+++ b/tests/tests_regression_nm.yml
|
|
||||||
@@ -3,8 +3,6 @@
|
|
||||||
# set network provider and gather facts
|
|
||||||
- hosts: all
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_states_initscripts.yml b/tests/tests_states_initscripts.yml
|
|
||||||
index fa94103..3e55a43 100644
|
|
||||||
--- a/tests/tests_states_initscripts.yml
|
|
||||||
+++ b/tests/tests_states_initscripts.yml
|
|
||||||
@@ -4,8 +4,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_states.yml' with initscripts as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: Set network provider to 'initscripts'
|
|
||||||
set_fact:
|
|
||||||
network_provider: initscripts
|
|
||||||
diff --git a/tests/tests_states_nm.yml b/tests/tests_states_nm.yml
|
|
||||||
index 34c8a24..3164a3a 100644
|
|
||||||
--- a/tests/tests_states_nm.yml
|
|
||||||
+++ b/tests/tests_states_nm.yml
|
|
||||||
@@ -5,8 +5,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_states.yml' with nm as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_team_nm.yml b/tests/tests_team_nm.yml
|
|
||||||
index 8048029..0516765 100644
|
|
||||||
--- a/tests/tests_team_nm.yml
|
|
||||||
+++ b/tests/tests_team_nm.yml
|
|
||||||
@@ -5,8 +5,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_team.yml' with nm as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_unit.yml b/tests/tests_unit.yml
|
|
||||||
index 44dfaec..8c5388b 100644
|
|
||||||
--- a/tests/tests_unit.yml
|
|
||||||
+++ b/tests/tests_unit.yml
|
|
||||||
@@ -3,7 +3,7 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Setup for test running
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
+ - include_tasks: tasks/enable_epel.yml
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
package:
|
|
||||||
diff --git a/tests/tests_vlan_mtu_initscripts.yml b/tests/tests_vlan_mtu_initscripts.yml
|
|
||||||
index dcd5d74..37770a9 100644
|
|
||||||
--- a/tests/tests_vlan_mtu_initscripts.yml
|
|
||||||
+++ b/tests/tests_vlan_mtu_initscripts.yml
|
|
||||||
@@ -4,8 +4,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_vlan_mtu.yml' with initscripts as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: Set network provider to 'initscripts'
|
|
||||||
set_fact:
|
|
||||||
network_provider: initscripts
|
|
||||||
diff --git a/tests/tests_vlan_mtu_nm.yml b/tests/tests_vlan_mtu_nm.yml
|
|
||||||
index c38263c..f201de3 100644
|
|
||||||
--- a/tests/tests_vlan_mtu_nm.yml
|
|
||||||
+++ b/tests/tests_vlan_mtu_nm.yml
|
|
||||||
@@ -5,8 +5,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_vlan_mtu.yml' with nm as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
diff --git a/tests/tests_wireless_nm.yml b/tests/tests_wireless_nm.yml
|
|
||||||
index 03b5ad6..86baf67 100644
|
|
||||||
--- a/tests/tests_wireless_nm.yml
|
|
||||||
+++ b/tests/tests_wireless_nm.yml
|
|
||||||
@@ -5,8 +5,6 @@
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_wireless.yml' with nm as provider
|
|
||||||
tasks:
|
|
||||||
- - include_tasks: tasks/el_repo_setup.yml
|
|
||||||
-
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
network_provider: nm
|
|
||||||
--
|
|
||||||
2.30.2
|
|
||||||
|
|
@ -1,567 +1,54 @@
|
|||||||
From c050984fda1e5bed1882335c30108b402b55b795 Mon Sep 17 00:00:00 2001
|
From 4b1a8a87e7d297fd6669d653af7308dd9c1a513a Mon Sep 17 00:00:00 2001
|
||||||
From: Rich Megginson <rmeggins@redhat.com>
|
From: Rich Megginson <rmeggins@redhat.com>
|
||||||
Date: Thu, 25 Mar 2021 13:55:52 -0600
|
Date: Thu, 6 May 2021 13:52:38 -0600
|
||||||
Subject: [PATCH 2/4] Patch52: network-tier1-tags.diff
|
Subject: [PATCH] tag 802-1x test as expfail; make sure bridge test cleans up
|
||||||
|
properly
|
||||||
|
|
||||||
|
The 802-1x test will fail on platforms where `hostapd` is not available,
|
||||||
|
so tag that test to make it skippable.
|
||||||
|
|
||||||
|
The initscripts bridge test does not clean up properly, leaving the
|
||||||
|
device around which causes the nm test to fail. Explicitly remove
|
||||||
|
the device for cleanup.
|
||||||
---
|
---
|
||||||
tests/playbooks/tests_802_1x.yml | 10 ++++++++
|
tests/playbooks/tests_802_1x.yml | 2 ++
|
||||||
tests/playbooks/tests_bond.yml | 10 ++++++++
|
tests/playbooks/tests_bridge.yml | 10 ++++++++++
|
||||||
tests/playbooks/tests_bridge.yml | 27 +++++++++++++++++++-
|
2 files changed, 12 insertions(+)
|
||||||
tests/playbooks/tests_checkpoint_cleanup.yml | 10 ++++++++
|
|
||||||
tests/playbooks/tests_ethernet.yml | 21 +++++++++++++++
|
|
||||||
tests/playbooks/tests_ethtool_features.yml | 10 ++++++++
|
|
||||||
tests/playbooks/tests_provider.yml | 10 ++++++++
|
|
||||||
tests/playbooks/tests_reapply.yml | 10 ++++++++
|
|
||||||
tests/playbooks/tests_states.yml | 20 +++++++++++++++
|
|
||||||
tests/playbooks/tests_vlan_mtu.yml | 18 +++++++++++++
|
|
||||||
tests/playbooks/tests_wireless.yml | 10 ++++++++
|
|
||||||
tests/tasks/commonvars.yml | 2 ++
|
|
||||||
tests/tasks/get_services_state.yml | 4 +++
|
|
||||||
tests/tasks/restore_services_state.yml | 22 ++++++++++++++++
|
|
||||||
tests/tasks/restore_state.yml | 24 +++++++++++++++++
|
|
||||||
tests/tasks/save_state.yml | 11 ++++++++
|
|
||||||
tests/tests_802_1x_nm.yml | 4 +++
|
|
||||||
tests/tests_802_1x_updated_nm.yml | 4 +++
|
|
||||||
tests/tests_default.yml | 8 ++++++
|
|
||||||
tests/tests_helpers_and_asserts.yml | 8 ++++++
|
|
||||||
20 files changed, 242 insertions(+), 1 deletion(-)
|
|
||||||
create mode 100644 tests/tasks/commonvars.yml
|
|
||||||
create mode 100644 tests/tasks/get_services_state.yml
|
|
||||||
create mode 100644 tests/tasks/restore_services_state.yml
|
|
||||||
create mode 100644 tests/tasks/restore_state.yml
|
|
||||||
create mode 100644 tests/tasks/save_state.yml
|
|
||||||
|
|
||||||
diff --git a/tests/playbooks/tests_802_1x.yml b/tests/playbooks/tests_802_1x.yml
|
diff --git a/tests/playbooks/tests_802_1x.yml b/tests/playbooks/tests_802_1x.yml
|
||||||
index 9cce1ae..76d99e9 100644
|
index 9cce1ae..4ceebb1 100644
|
||||||
--- a/tests/playbooks/tests_802_1x.yml
|
--- a/tests/playbooks/tests_802_1x.yml
|
||||||
+++ b/tests/playbooks/tests_802_1x.yml
|
+++ b/tests/playbooks/tests_802_1x.yml
|
||||||
@@ -1,5 +1,10 @@
|
@@ -3,6 +3,8 @@
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
---
|
|
||||||
+- name: Save host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
- hosts: all
|
- hosts: all
|
||||||
vars:
|
vars:
|
||||||
interface: 802-1x-test
|
interface: 802-1x-test
|
||||||
@@ -122,3 +127,8 @@
|
+ tags:
|
||||||
command: update-ca-trust
|
+ - tests::expfail
|
||||||
tags:
|
tasks:
|
||||||
- "tests::cleanup"
|
- name: "INIT: 802.1x tests"
|
||||||
+
|
debug:
|
||||||
+- name: Restore host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/restore_state.yml
|
|
||||||
diff --git a/tests/playbooks/tests_bond.yml b/tests/playbooks/tests_bond.yml
|
|
||||||
index 69f07f8..1e45788 100644
|
|
||||||
--- a/tests/playbooks/tests_bond.yml
|
|
||||||
+++ b/tests/playbooks/tests_bond.yml
|
|
||||||
@@ -1,5 +1,10 @@
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
---
|
|
||||||
+- name: Save host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
- hosts: all
|
|
||||||
vars:
|
|
||||||
controller_profile: bond0
|
|
||||||
@@ -95,3 +100,8 @@
|
|
||||||
- import_tasks: tasks/remove_test_interfaces_with_dhcp.yml
|
|
||||||
tags:
|
|
||||||
- "tests::cleanup"
|
|
||||||
+
|
|
||||||
+- name: Restore host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/restore_state.yml
|
|
||||||
diff --git a/tests/playbooks/tests_bridge.yml b/tests/playbooks/tests_bridge.yml
|
diff --git a/tests/playbooks/tests_bridge.yml b/tests/playbooks/tests_bridge.yml
|
||||||
index d79d6ad..c8cf3cd 100644
|
index d79d6ad..14b1225 100644
|
||||||
--- a/tests/playbooks/tests_bridge.yml
|
--- a/tests/playbooks/tests_bridge.yml
|
||||||
+++ b/tests/playbooks/tests_bridge.yml
|
+++ b/tests/playbooks/tests_bridge.yml
|
||||||
@@ -1,5 +1,10 @@
|
@@ -49,6 +49,16 @@
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
---
|
|
||||||
+- name: Save host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
- name: Test configuring bridges
|
|
||||||
hosts: all
|
|
||||||
vars:
|
|
||||||
@@ -14,6 +19,8 @@
|
|
||||||
|
|
||||||
- name: Add test bridge
|
|
||||||
hosts: all
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::net::bridge'
|
|
||||||
vars:
|
|
||||||
network_connections:
|
|
||||||
- name: "{{ interface }}"
|
|
||||||
@@ -36,11 +43,15 @@
|
|
||||||
task: tasks/assert_profile_present.yml
|
|
||||||
|
|
||||||
- import_playbook: down_profile.yml
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::net::bridge'
|
|
||||||
vars:
|
|
||||||
profile: "{{ interface }}"
|
profile: "{{ interface }}"
|
||||||
# FIXME: assert profile/device down
|
task: tasks/assert_profile_absent.yml
|
||||||
|
|
||||||
- import_playbook: remove_profile.yml
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::net::bridge'
|
|
||||||
vars:
|
|
||||||
profile: "{{ interface }}"
|
|
||||||
|
|
||||||
@@ -51,5 +62,19 @@
|
|
||||||
|
|
||||||
# FIXME: Devices might still be left when profile is absent
|
|
||||||
# - import_playbook: run_tasks.yml
|
|
||||||
-# vars:
|
|
||||||
+# vars:
|
|
||||||
# task: tasks/assert_device_absent.yml
|
|
||||||
+
|
|
||||||
+- name: Remove test bridge
|
+- name: Remove test bridge
|
||||||
+ hosts: all
|
+ hosts: all
|
||||||
+ tags:
|
+ tags:
|
||||||
+ - 'tests::cleanup'
|
+ - tests::cleanup
|
||||||
+ - 'tests::net::bridge::cleanup'
|
|
||||||
+ tasks:
|
+ tasks:
|
||||||
+ - command: 'ip link delete "{{ interface }}"'
|
+ - name: Remove the test interface
|
||||||
|
+ command: ip link delete {{ interface | quote }}
|
||||||
+ ignore_errors: yes
|
+ ignore_errors: yes
|
||||||
|
+ changed_when: false
|
||||||
+
|
+
|
||||||
+- name: Restore host state
|
# FIXME: Devices might still be left when profile is absent
|
||||||
+ hosts: all
|
# - import_playbook: run_tasks.yml
|
||||||
+ tasks:
|
# vars:
|
||||||
+ - import_tasks: tasks/restore_state.yml
|
|
||||||
diff --git a/tests/playbooks/tests_checkpoint_cleanup.yml b/tests/playbooks/tests_checkpoint_cleanup.yml
|
|
||||||
index 18e3fd7..3b5a41a 100644
|
|
||||||
--- a/tests/playbooks/tests_checkpoint_cleanup.yml
|
|
||||||
+++ b/tests/playbooks/tests_checkpoint_cleanup.yml
|
|
||||||
@@ -4,6 +4,11 @@
|
|
||||||
# mark a device as unmanaged for NM and then tries to activiate it using NM.
|
|
||||||
# This failed without removing the checkpoint.
|
|
||||||
---
|
|
||||||
+- name: Save host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
- hosts: all
|
|
||||||
vars:
|
|
||||||
interface: cptstbr
|
|
||||||
@@ -80,3 +85,8 @@
|
|
||||||
ignore_errors: true
|
|
||||||
tags:
|
|
||||||
- "tests::cleanup"
|
|
||||||
+
|
|
||||||
+- name: Restore host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/restore_state.yml
|
|
||||||
diff --git a/tests/playbooks/tests_ethernet.yml b/tests/playbooks/tests_ethernet.yml
|
|
||||||
index cd02579..adcffee 100644
|
|
||||||
--- a/tests/playbooks/tests_ethernet.yml
|
|
||||||
+++ b/tests/playbooks/tests_ethernet.yml
|
|
||||||
@@ -1,5 +1,10 @@
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
---
|
|
||||||
+- name: Save host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
- hosts: all
|
|
||||||
tasks:
|
|
||||||
- debug:
|
|
||||||
@@ -9,6 +14,8 @@
|
|
||||||
|
|
||||||
- name: Test configuring ethernet devices
|
|
||||||
hosts: all
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::net::veth'
|
|
||||||
vars:
|
|
||||||
type: veth
|
|
||||||
interface: lsr27
|
|
||||||
@@ -26,6 +33,8 @@
|
|
||||||
|
|
||||||
- name: Test static interface up
|
|
||||||
hosts: all
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::net::reconf'
|
|
||||||
vars:
|
|
||||||
network_connections:
|
|
||||||
- name: "{{ interface }}"
|
|
||||||
@@ -48,17 +57,29 @@
|
|
||||||
# FIXME: assert profile present
|
|
||||||
# FIXME: assert profile/device up + IP address
|
|
||||||
- import_playbook: down_profile.yml
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::cleanup'
|
|
||||||
vars:
|
|
||||||
profile: "{{ interface }}"
|
|
||||||
# FIXME: assert profile/device down
|
|
||||||
- import_playbook: remove_profile.yml
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::cleanup'
|
|
||||||
vars:
|
|
||||||
profile: "{{ interface }}"
|
|
||||||
# FIXME: assert profile away
|
|
||||||
- name: Remove interfaces
|
|
||||||
hosts: all
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::cleanup'
|
|
||||||
+ - 'tests::net::veth::cleanup'
|
|
||||||
tasks:
|
|
||||||
- include_tasks: tasks/manage_test_interface.yml
|
|
||||||
vars:
|
|
||||||
state: absent
|
|
||||||
- include_tasks: tasks/assert_device_absent.yml
|
|
||||||
+
|
|
||||||
+- name: Restore host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/restore_state.yml
|
|
||||||
diff --git a/tests/playbooks/tests_ethtool_features.yml b/tests/playbooks/tests_ethtool_features.yml
|
|
||||||
index 43fddc3..d1a87fe 100644
|
|
||||||
--- a/tests/playbooks/tests_ethtool_features.yml
|
|
||||||
+++ b/tests/playbooks/tests_ethtool_features.yml
|
|
||||||
@@ -1,5 +1,10 @@
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
---
|
|
||||||
+- name: Save host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
- hosts: all
|
|
||||||
vars:
|
|
||||||
interface: testnic1
|
|
||||||
@@ -198,3 +203,8 @@
|
|
||||||
state: absent
|
|
||||||
tags:
|
|
||||||
- "tests::cleanup"
|
|
||||||
+
|
|
||||||
+- name: Restore host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/restore_state.yml
|
|
||||||
diff --git a/tests/playbooks/tests_provider.yml b/tests/playbooks/tests_provider.yml
|
|
||||||
index 1db2d08..e097b4b 100644
|
|
||||||
--- a/tests/playbooks/tests_provider.yml
|
|
||||||
+++ b/tests/playbooks/tests_provider.yml
|
|
||||||
@@ -1,5 +1,10 @@
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
---
|
|
||||||
+- name: Save host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
- hosts: all
|
|
||||||
vars:
|
|
||||||
interface: testnic1
|
|
||||||
@@ -33,3 +38,8 @@
|
|
||||||
- tasks/cleanup_profile+device.yml
|
|
||||||
tags:
|
|
||||||
- tests::provider:initscripts_to_nm
|
|
||||||
+
|
|
||||||
+- name: Restore host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/restore_state.yml
|
|
||||||
diff --git a/tests/playbooks/tests_reapply.yml b/tests/playbooks/tests_reapply.yml
|
|
||||||
index 4b1cb09..6995607 100644
|
|
||||||
--- a/tests/playbooks/tests_reapply.yml
|
|
||||||
+++ b/tests/playbooks/tests_reapply.yml
|
|
||||||
@@ -4,6 +4,11 @@
|
|
||||||
# of via Ansible. Until there is better test support for this, just check the
|
|
||||||
# log output for the respective log message.
|
|
||||||
---
|
|
||||||
+- name: Save host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
- hosts: all
|
|
||||||
vars:
|
|
||||||
interface: rpltstbr
|
|
||||||
@@ -64,3 +69,8 @@
|
|
||||||
ignore_errors: true
|
|
||||||
tags:
|
|
||||||
- "tests::cleanup"
|
|
||||||
+
|
|
||||||
+- name: Restore host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/restore_state.yml
|
|
||||||
diff --git a/tests/playbooks/tests_states.yml b/tests/playbooks/tests_states.yml
|
|
||||||
index eec27c0..a8d0ecd 100644
|
|
||||||
--- a/tests/playbooks/tests_states.yml
|
|
||||||
+++ b/tests/playbooks/tests_states.yml
|
|
||||||
@@ -135,3 +135,23 @@
|
|
||||||
- tasks/cleanup_profile+device.yml
|
|
||||||
tags:
|
|
||||||
- tests::states:remove_down_twice
|
|
||||||
+
|
|
||||||
+ pre_tasks:
|
|
||||||
+ - name: Save host state
|
|
||||||
+ import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
+ post_tasks:
|
|
||||||
+ - name: Remove test profile
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::cleanup'
|
|
||||||
+ - 'tests::net::bridge::cleanup'
|
|
||||||
+ import_role:
|
|
||||||
+ name: linux-system-roles.network
|
|
||||||
+ vars:
|
|
||||||
+ network_connections:
|
|
||||||
+ - name: statebr
|
|
||||||
+ state: down
|
|
||||||
+ persistent_state: absent
|
|
||||||
+
|
|
||||||
+ - name: Restore host state
|
|
||||||
+ import_tasks: tasks/restore_state.yml
|
|
||||||
diff --git a/tests/playbooks/tests_vlan_mtu.yml b/tests/playbooks/tests_vlan_mtu.yml
|
|
||||||
index 029b599..378d5fe 100644
|
|
||||||
--- a/tests/playbooks/tests_vlan_mtu.yml
|
|
||||||
+++ b/tests/playbooks/tests_vlan_mtu.yml
|
|
||||||
@@ -10,6 +10,8 @@
|
|
||||||
- include_tasks: tasks/manage_test_interface.yml
|
|
||||||
vars:
|
|
||||||
state: present
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::net::veth'
|
|
||||||
- include_tasks: tasks/assert_device_present.yml
|
|
||||||
- name: >-
|
|
||||||
TEST: I can configure the MTU for a vlan interface without autoconnect.
|
|
||||||
@@ -38,6 +40,8 @@
|
|
||||||
ip:
|
|
||||||
dhcp4: false
|
|
||||||
auto6: false
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::net::reconf'
|
|
||||||
- include_tasks: tasks/assert_device_present.yml
|
|
||||||
vars:
|
|
||||||
interface: "{{ vlan_interface }}"
|
|
||||||
@@ -62,6 +66,20 @@
|
|
||||||
persistent_state: absent
|
|
||||||
state: down
|
|
||||||
ignore_errors: true
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::cleanup'
|
|
||||||
+ - 'tests::net::veth::cleanup'
|
|
||||||
- include_tasks: tasks/manage_test_interface.yml
|
|
||||||
vars:
|
|
||||||
state: absent
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::cleanup'
|
|
||||||
+ - 'tests::net::veth::cleanup'
|
|
||||||
+
|
|
||||||
+ pre_tasks:
|
|
||||||
+ - name: Save host state
|
|
||||||
+ import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
+ post_tasks:
|
|
||||||
+ - name: Restore host state
|
|
||||||
+ import_tasks: tasks/restore_state.yml
|
|
||||||
diff --git a/tests/playbooks/tests_wireless.yml b/tests/playbooks/tests_wireless.yml
|
|
||||||
index 822a15e..52661bd 100644
|
|
||||||
--- a/tests/playbooks/tests_wireless.yml
|
|
||||||
+++ b/tests/playbooks/tests_wireless.yml
|
|
||||||
@@ -1,5 +1,10 @@
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
---
|
|
||||||
+- name: Save host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
- hosts: all
|
|
||||||
vars:
|
|
||||||
interface: wlan0
|
|
||||||
@@ -86,3 +91,8 @@
|
|
||||||
- include_tasks: tasks/cleanup_mock_wifi.yml
|
|
||||||
tags:
|
|
||||||
- "tests::cleanup"
|
|
||||||
+
|
|
||||||
+- name: Restore host state
|
|
||||||
+ hosts: all
|
|
||||||
+ tasks:
|
|
||||||
+ - import_tasks: tasks/restore_state.yml
|
|
||||||
diff --git a/tests/tasks/commonvars.yml b/tests/tasks/commonvars.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..50452f7
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/tasks/commonvars.yml
|
|
||||||
@@ -0,0 +1,2 @@
|
|
||||||
+restore_services:
|
|
||||||
+ - NetworkManager
|
|
||||||
diff --git a/tests/tasks/get_services_state.yml b/tests/tasks/get_services_state.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..4fe5d36
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/tasks/get_services_state.yml
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+- name: Get initial state of services
|
|
||||||
+ tags: tests::cleanup
|
|
||||||
+ service_facts:
|
|
||||||
+ register: initial_state
|
|
||||||
diff --git a/tests/tasks/restore_services_state.yml b/tests/tasks/restore_services_state.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..2035dfc
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/tasks/restore_services_state.yml
|
|
||||||
@@ -0,0 +1,22 @@
|
|
||||||
+- block:
|
|
||||||
+ - name: load common vars
|
|
||||||
+ include_vars:
|
|
||||||
+ file: commonvars.yml
|
|
||||||
+
|
|
||||||
+ - name: Get final state of services
|
|
||||||
+ service_facts:
|
|
||||||
+ register: final_state
|
|
||||||
+
|
|
||||||
+ - name: Restore state of services
|
|
||||||
+ service:
|
|
||||||
+ name: "{{ item }}"
|
|
||||||
+ state: "{{ 'started' if
|
|
||||||
+ initial_state.ansible_facts.services[sname]['state']
|
|
||||||
+ == 'running' else 'stopped' }}"
|
|
||||||
+ when:
|
|
||||||
+ - sname in final_state.ansible_facts.services
|
|
||||||
+ - sname in initial_state.ansible_facts.services
|
|
||||||
+ vars:
|
|
||||||
+ sname: "{{ item + '.service' }}"
|
|
||||||
+ with_items: "{{ restore_services }}"
|
|
||||||
+ tags: tests::cleanup
|
|
||||||
diff --git a/tests/tasks/restore_state.yml b/tests/tasks/restore_state.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..f4e3d5f
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/tasks/restore_state.yml
|
|
||||||
@@ -0,0 +1,24 @@
|
|
||||||
+---
|
|
||||||
+- name: Remove /etc/sysconfig/network if there was no one
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::cleanup'
|
|
||||||
+ file:
|
|
||||||
+ path: /etc/sysconfig/network
|
|
||||||
+ state: absent
|
|
||||||
+ when:
|
|
||||||
+ - etc_sysconfig_network_stat is defined
|
|
||||||
+ - not etc_sysconfig_network_stat.stat.exists
|
|
||||||
+
|
|
||||||
+- name: Restore services
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
+
|
|
||||||
+- name: reload NetworkManager
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::cleanup'
|
|
||||||
+ command: nmcli connection reload
|
|
||||||
+ when:
|
|
||||||
+ - sname in final_state.ansible_facts.services
|
|
||||||
+ - sname in initial_state.ansible_facts.services
|
|
||||||
+ - final_state.ansible_facts.services[sname]['state'] == 'running'
|
|
||||||
+ vars:
|
|
||||||
+ sname: NetworkManager.service
|
|
||||||
diff --git a/tests/tasks/save_state.yml b/tests/tasks/save_state.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..5690aed
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/tasks/save_state.yml
|
|
||||||
@@ -0,0 +1,11 @@
|
|
||||||
+---
|
|
||||||
+- name: Get services state
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
+- name: Investigate /etc/sysconfig/network presence
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::cleanup'
|
|
||||||
+ stat:
|
|
||||||
+ path: /etc/sysconfig/network
|
|
||||||
+ register: etc_sysconfig_network_stat
|
|
||||||
+ ignore_errors: yes
|
|
||||||
diff --git a/tests/tests_802_1x_nm.yml b/tests/tests_802_1x_nm.yml
|
|
||||||
index 288cd5d..840958d 100644
|
|
||||||
--- a/tests/tests_802_1x_nm.yml
|
|
||||||
+++ b/tests/tests_802_1x_nm.yml
|
|
||||||
@@ -4,6 +4,8 @@
|
|
||||||
# set network provider and gather facts
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_802_1x.yml' with nm as provider
|
|
||||||
+ tags:
|
|
||||||
+ - tests::expfail
|
|
||||||
tasks:
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
@@ -17,3 +19,5 @@
|
|
||||||
- import_playbook: playbooks/tests_802_1x.yml
|
|
||||||
when:
|
|
||||||
- ansible_distribution_major_version != '6'
|
|
||||||
+ tags:
|
|
||||||
+ - tests::expfail
|
|
||||||
diff --git a/tests/tests_802_1x_updated_nm.yml b/tests/tests_802_1x_updated_nm.yml
|
|
||||||
index bd335e4..4ebcaf9 100644
|
|
||||||
--- a/tests/tests_802_1x_updated_nm.yml
|
|
||||||
+++ b/tests/tests_802_1x_updated_nm.yml
|
|
||||||
@@ -4,6 +4,8 @@
|
|
||||||
# set network provider and gather facts
|
|
||||||
- hosts: all
|
|
||||||
name: Run playbook 'playbooks/tests_802_1x_updated.yml' with nm as provider
|
|
||||||
+ tags:
|
|
||||||
+ - tests::expfail
|
|
||||||
tasks:
|
|
||||||
- name: Set network provider to 'nm'
|
|
||||||
set_fact:
|
|
||||||
@@ -17,3 +19,5 @@
|
|
||||||
- import_playbook: playbooks/tests_802_1x_updated.yml
|
|
||||||
when:
|
|
||||||
- ansible_distribution_major_version != '6'
|
|
||||||
+ tags:
|
|
||||||
+ - tests::expfail
|
|
||||||
diff --git a/tests/tests_default.yml b/tests/tests_default.yml
|
|
||||||
index f6f7550..98e3c7e 100644
|
|
||||||
--- a/tests/tests_default.yml
|
|
||||||
+++ b/tests/tests_default.yml
|
|
||||||
@@ -10,3 +10,11 @@
|
|
||||||
that:
|
|
||||||
- "'warnings' not in __network_connections_result"
|
|
||||||
msg: "There are warnings"
|
|
||||||
+
|
|
||||||
+ pre_tasks:
|
|
||||||
+ - name: Save host state
|
|
||||||
+ import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
+ post_tasks:
|
|
||||||
+ - name: Restore host state
|
|
||||||
+ import_tasks: tasks/restore_state.yml
|
|
||||||
diff --git a/tests/tests_helpers_and_asserts.yml b/tests/tests_helpers_and_asserts.yml
|
|
||||||
index 5514182..d9bfa11 100644
|
|
||||||
--- a/tests/tests_helpers_and_asserts.yml
|
|
||||||
+++ b/tests/tests_helpers_and_asserts.yml
|
|
||||||
@@ -15,6 +15,14 @@
|
|
||||||
type: dummy
|
|
||||||
interface: dummy1298
|
|
||||||
|
|
||||||
+ pre_tasks:
|
|
||||||
+ - name: Save host state
|
|
||||||
+ import_tasks: tasks/save_state.yml
|
|
||||||
+
|
|
||||||
+ post_tasks:
|
|
||||||
+ - name: Restore host state
|
|
||||||
+ import_tasks: tasks/restore_state.yml
|
|
||||||
+
|
|
||||||
# FIXME: when: does not seem to work with include_tasks, therefore this cannot
|
|
||||||
# be safely tested for now
|
|
||||||
# - name: test tap interfaces
|
|
||||||
--
|
--
|
||||||
2.30.2
|
2.30.2
|
||||||
|
|
||||||
|
@ -1,80 +0,0 @@
|
|||||||
diff --git a/tasks/ssh.yml b/tasks/ssh.yml
|
|
||||||
index 1a4e858..b05d01a 100644
|
|
||||||
--- a/tasks/ssh.yml
|
|
||||||
+++ b/tasks/ssh.yml
|
|
||||||
@@ -18,3 +18,15 @@
|
|
||||||
key: "{{ keydata.content|b64decode }}"
|
|
||||||
state: present
|
|
||||||
delegate_to: "{{ kdump_ssh_server }}"
|
|
||||||
+
|
|
||||||
+- name: Fetch the servers public key
|
|
||||||
+ slurp:
|
|
||||||
+ src: /etc/ssh/ssh_host_rsa_key.pub
|
|
||||||
+ register: serverpubkey
|
|
||||||
+ delegate_to: "{{ kdump_ssh_server }}"
|
|
||||||
+
|
|
||||||
+- name: Add the servers public key to known_hosts on managed node
|
|
||||||
+ known_hosts:
|
|
||||||
+ key: "{{ kdump_ssh_server_location }} {{ serverpubkey.content | b64decode }}"
|
|
||||||
+ name: "{{ kdump_ssh_server_location }}"
|
|
||||||
+ path: /etc/ssh/ssh_known_hosts
|
|
||||||
diff --git a/templates/kdump.conf.j2 b/templates/kdump.conf.j2
|
|
||||||
index bf24210..504ff34 100644
|
|
||||||
--- a/templates/kdump.conf.j2
|
|
||||||
+++ b/templates/kdump.conf.j2
|
|
||||||
@@ -1,12 +1,17 @@
|
|
||||||
# {{ ansible_managed }}
|
|
||||||
|
|
||||||
{% if kdump_target %}
|
|
||||||
-{{ kdump_target.type }} {{ kdump_target.location }}
|
|
||||||
-{% endif %}
|
|
||||||
+{% if kdump_target.type == "ssh" %}
|
|
||||||
+ssh {{ kdump_target.location | d(kdump_ssh_user ~ '@' ~ kdump_ssh_server) }}
|
|
||||||
|
|
||||||
-{% if kdump_target and kdump_target.type == "ssh" and kdump_sshkey != '/root/.ssh/kdump_id_rsa' %}
|
|
||||||
+{% if kdump_sshkey != '/root/.ssh/kdump_id_rsa' %}
|
|
||||||
sshkey {{ kdump_sshkey }}
|
|
||||||
{% endif %}
|
|
||||||
+{% else %}
|
|
||||||
+{{ kdump_target.type }} {{ kdump_target.location }}
|
|
||||||
+
|
|
||||||
+{% endif %}
|
|
||||||
+{% endif %}
|
|
||||||
|
|
||||||
path {{ kdump_path }}
|
|
||||||
{% if kdump_core_collector %}
|
|
||||||
diff --git a/tests/tests_ssh.yml b/tests/tests_ssh.yml
|
|
||||||
index 1da99df..d12e884 100644
|
|
||||||
--- a/tests/tests_ssh.yml
|
|
||||||
+++ b/tests/tests_ssh.yml
|
|
||||||
@@ -5,6 +5,11 @@
|
|
||||||
# known and ansible is supposed to be configured to be able to
|
|
||||||
# connect to it (via inventory).
|
|
||||||
kdump_ssh_server_outside: localhost
|
|
||||||
+ kdump_ssh_source: "{{ ansible_env['SSH_CONNECTION'].split()[0] }}"
|
|
||||||
+
|
|
||||||
+ # this is the address at which the ssh dump server can be reached
|
|
||||||
+ # from the managed host. Dumps will be uploaded there.
|
|
||||||
+ kdump_ssh_server_inside: "{{ kdump_ssh_source if kdump_ssh_source in hostvars[kdump_ssh_server_outside]['ansible_all_ipv4_addresses'] + hostvars[kdump_ssh_server_outside]['ansible_all_ipv6_addresses'] else hostvars[kdump_ssh_server_outside]['ansible_default_ipv4']['address'] }}"
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- name: gather facts from {{ kdump_ssh_server_outside }}
|
|
||||||
@@ -25,8 +30,5 @@
|
|
||||||
type: ssh
|
|
||||||
# This is the ssh dump server address visible from inside
|
|
||||||
# the machine being configured. Dumps are to be copied
|
|
||||||
- # there. We make here the assumption that this machine is
|
|
||||||
- # being run as a VM and the dump server is the VM host
|
|
||||||
- # (i.e. for ansible this is localhost). From the VM its
|
|
||||||
- # address is then identical to the default route.
|
|
||||||
- location: "{{ kdump_ssh_user }}@{{ ansible_default_ipv4.gateway }}"
|
|
||||||
+ # there.
|
|
||||||
+ location: "{{ kdump_ssh_user }}@{{ kdump_ssh_server_inside }}"
|
|
||||||
diff --git a/vars/main.yml b/vars/main.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..34d2d62
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/vars/main.yml
|
|
||||||
@@ -0,0 +1,2 @@
|
|
||||||
+# determine the managed node facing ssh server address
|
|
||||||
+kdump_ssh_server_location: "{{ kdump_target.location | regex_replace('.*@(.*)$', '\\1') if kdump_target.location is defined else kdump_ssh_server }}"
|
|
@ -1,195 +0,0 @@
|
|||||||
From 4a8f0c2b240ffccde5018d2de1166e6c22daa500 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Rich Megginson <rmeggins@redhat.com>
|
|
||||||
Date: Mon, 22 Mar 2021 17:13:26 -0600
|
|
||||||
Subject: [PATCH] add tags; fix cleanup task
|
|
||||||
|
|
||||||
---
|
|
||||||
tests/set_selinux_variables.yml | 8 ++++++
|
|
||||||
tests/tests_all_purge.yml | 6 ++++-
|
|
||||||
tests/tests_all_transitions.yml | 2 ++
|
|
||||||
tests/tests_boolean.yml | 3 ++-
|
|
||||||
tests/tests_fcontext.yml | 2 +-
|
|
||||||
tests/tests_login.yml | 2 +-
|
|
||||||
tests/tests_port.yml | 2 +-
|
|
||||||
tests/tests_selinux_disabled.yml | 45 +++++++++++++++++++++-----------
|
|
||||||
8 files changed, 50 insertions(+), 20 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/set_selinux_variables.yml b/tests/set_selinux_variables.yml
|
|
||||||
index 05f0c88..3446647 100644
|
|
||||||
--- a/tests/set_selinux_variables.yml
|
|
||||||
+++ b/tests/set_selinux_variables.yml
|
|
||||||
@@ -1,4 +1,12 @@
|
|
||||||
---
|
|
||||||
+- name: Install SELinux tool semanage on Fedora
|
|
||||||
+ package:
|
|
||||||
+ name:
|
|
||||||
+ - policycoreutils-python-utils
|
|
||||||
+ state: present
|
|
||||||
+ when: ansible_distribution == "Fedora" or
|
|
||||||
+ ( ansible_distribution_major_version > "7" and
|
|
||||||
+ ( ansible_distribution == "CentOS" or ansible_distribution == "RedHat" ))
|
|
||||||
- name: Get local modifications - boolean
|
|
||||||
command: /usr/sbin/semanage boolean -l -n -C
|
|
||||||
changed_when: false
|
|
||||||
diff --git a/tests/tests_all_purge.yml b/tests/tests_all_purge.yml
|
|
||||||
index 40e933b..4688994 100644
|
|
||||||
--- a/tests/tests_all_purge.yml
|
|
||||||
+++ b/tests/tests_all_purge.yml
|
|
||||||
@@ -8,13 +8,17 @@
|
|
||||||
fcontext -a -t user_home_dir_t /tmp/test_dir
|
|
||||||
login -a -s staff_u sar-user
|
|
||||||
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::avc'
|
|
||||||
tasks:
|
|
||||||
- name: Install SELinux tool semanage on Fedora
|
|
||||||
package:
|
|
||||||
name:
|
|
||||||
- policycoreutils-python-utils
|
|
||||||
state: present
|
|
||||||
- when: ansible_distribution == "Fedora"
|
|
||||||
+ when: ansible_distribution == "Fedora" or
|
|
||||||
+ ( ansible_distribution_major_version > "7" and
|
|
||||||
+ ( ansible_distribution == "CentOS" or ansible_distribution == "RedHat" ))
|
|
||||||
|
|
||||||
- name: Add a Linux System Roles SELinux User
|
|
||||||
user:
|
|
||||||
diff --git a/tests/tests_all_transitions.yml b/tests/tests_all_transitions.yml
|
|
||||||
index acd37ad..20f96c4 100644
|
|
||||||
--- a/tests/tests_all_transitions.yml
|
|
||||||
+++ b/tests/tests_all_transitions.yml
|
|
||||||
@@ -1,6 +1,8 @@
|
|
||||||
- name: Test all the possible selinux_state transitions
|
|
||||||
hosts: all
|
|
||||||
become: true
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::reboot'
|
|
||||||
vars:
|
|
||||||
states:
|
|
||||||
- permissive
|
|
||||||
diff --git a/tests/tests_boolean.yml b/tests/tests_boolean.yml
|
|
||||||
index 368e8dc..966abe4 100644
|
|
||||||
--- a/tests/tests_boolean.yml
|
|
||||||
+++ b/tests/tests_boolean.yml
|
|
||||||
@@ -1,4 +1,5 @@
|
|
||||||
- name: Check if selinux role sets SELinux booleans
|
|
||||||
+ tags: tests::expfail
|
|
||||||
hosts: all
|
|
||||||
become: true
|
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@
|
|
||||||
selinux_booleans:
|
|
||||||
- { name: 'samba_enable_home_dirs', state: 'on', persistent: 'yes' }
|
|
||||||
|
|
||||||
- - include: set_selinux_variables.yml
|
|
||||||
+ - import_tasks: set_selinux_variables.yml
|
|
||||||
- name: save state after initial changes and before other changes
|
|
||||||
set_fact:
|
|
||||||
boolean_before: "{{ selinux_role_boolean.stdout_lines }}"
|
|
||||||
diff --git a/tests/tests_fcontext.yml b/tests/tests_fcontext.yml
|
|
||||||
index b96b07a..aa1e1fa 100644
|
|
||||||
--- a/tests/tests_fcontext.yml
|
|
||||||
+++ b/tests/tests_fcontext.yml
|
|
||||||
@@ -13,7 +13,7 @@
|
|
||||||
- { target: '/tmp/test_dir1(/.*)?', setype: 'user_home_dir_t',
|
|
||||||
ftype: 'd' }
|
|
||||||
|
|
||||||
- - include: set_selinux_variables.yml
|
|
||||||
+ - import_tasks: set_selinux_variables.yml
|
|
||||||
- name: save state after initial changes and before other changes
|
|
||||||
set_fact:
|
|
||||||
fcontext_before: "{{ selinux_role_fcontext.stdout }}"
|
|
||||||
diff --git a/tests/tests_login.yml b/tests/tests_login.yml
|
|
||||||
index 67c6a9f..4ce8a0b 100644
|
|
||||||
--- a/tests/tests_login.yml
|
|
||||||
+++ b/tests/tests_login.yml
|
|
||||||
@@ -17,7 +17,7 @@
|
|
||||||
- { login: 'sar-user', seuser: 'staff_u',
|
|
||||||
serange: 's0-s0:c0.c1023', state: 'present' }
|
|
||||||
|
|
||||||
- - include: set_selinux_variables.yml
|
|
||||||
+ - import_tasks: set_selinux_variables.yml
|
|
||||||
- name: save state after initial changes and before other changes
|
|
||||||
set_fact:
|
|
||||||
login_before: "{{ selinux_role_login.stdout }}"
|
|
||||||
diff --git a/tests/tests_port.yml b/tests/tests_port.yml
|
|
||||||
index 5b651b0..4172dcb 100644
|
|
||||||
--- a/tests/tests_port.yml
|
|
||||||
+++ b/tests/tests_port.yml
|
|
||||||
@@ -29,7 +29,7 @@
|
|
||||||
- { ports: '22022', proto: 'tcp', setype: 'ssh_port_t',
|
|
||||||
state: 'present' }
|
|
||||||
|
|
||||||
- - include: set_selinux_variables.yml
|
|
||||||
+ - import_tasks: set_selinux_variables.yml
|
|
||||||
- name: save state after other changes
|
|
||||||
set_fact:
|
|
||||||
port_after: "{{ selinux_role_port.stdout }}"
|
|
||||||
diff --git a/tests/tests_selinux_disabled.yml b/tests/tests_selinux_disabled.yml
|
|
||||||
index a0dbaeb..4d896a0 100644
|
|
||||||
--- a/tests/tests_selinux_disabled.yml
|
|
||||||
+++ b/tests/tests_selinux_disabled.yml
|
|
||||||
@@ -11,13 +11,17 @@
|
|
||||||
fcontext -a -t user_home_dir_t /tmp/test_dir
|
|
||||||
login -a -s staff_u sar-user
|
|
||||||
|
|
||||||
+ tags:
|
|
||||||
+ - 'tests::avc'
|
|
||||||
tasks:
|
|
||||||
- name: Install SELinux tool semanage on Fedora
|
|
||||||
package:
|
|
||||||
name:
|
|
||||||
- policycoreutils-python-utils
|
|
||||||
state: present
|
|
||||||
- when: ansible_distribution == "Fedora"
|
|
||||||
+ when: ansible_distribution == "Fedora" or
|
|
||||||
+ ( ansible_distribution_major_version > "7" and
|
|
||||||
+ ( ansible_distribution == "CentOS" or ansible_distribution == "RedHat" ))
|
|
||||||
|
|
||||||
- name: Add a Linux System Roles SELinux User
|
|
||||||
user:
|
|
||||||
@@ -80,18 +84,29 @@
|
|
||||||
that: "{{ ansible_selinux.config_mode == 'enforcing' }}"
|
|
||||||
msg: "SELinux config mode should be enforcing instead of
|
|
||||||
{{ ansible_selinux.config_mode }}"
|
|
||||||
- - name: Restore original /etc/selinux/config
|
|
||||||
- copy:
|
|
||||||
- remote_src: true
|
|
||||||
- dest: /etc/selinux/config
|
|
||||||
- src: /etc/selinux/config.test_selinux_disabled
|
|
||||||
- mode: preserve
|
|
||||||
- - name: Remove /etc/selinux/config backup
|
|
||||||
- file:
|
|
||||||
- path: /etc/selinux/config.test_selinux_disabled
|
|
||||||
- state: absent
|
|
||||||
- - name: Remove Linux System Roles SELinux User
|
|
||||||
- user:
|
|
||||||
- name: sar-user
|
|
||||||
- remove: yes
|
|
||||||
- state: absent
|
|
||||||
+
|
|
||||||
+ - name: Cleanup
|
|
||||||
+ tags: [ 'tests::cleanup' ]
|
|
||||||
+ block:
|
|
||||||
+ - name: Restore original /etc/selinux/config
|
|
||||||
+ copy:
|
|
||||||
+ remote_src: true
|
|
||||||
+ dest: /etc/selinux/config
|
|
||||||
+ src: /etc/selinux/config.test_selinux_disabled
|
|
||||||
+ mode: preserve
|
|
||||||
+
|
|
||||||
+ - name: Remove /etc/selinux/config backup
|
|
||||||
+ file:
|
|
||||||
+ path: /etc/selinux/config.test_selinux_disabled
|
|
||||||
+ state: absent
|
|
||||||
+
|
|
||||||
+ - name: Remove Linux System Roles SELinux User
|
|
||||||
+ user:
|
|
||||||
+ name: sar-user
|
|
||||||
+ remove: yes
|
|
||||||
+ state: absent
|
|
||||||
+
|
|
||||||
+ - import_role:
|
|
||||||
+ name: linux-system-roles.selinux
|
|
||||||
+ vars:
|
|
||||||
+ selinux_all_purge: true
|
|
@ -1,9 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: "{{ targets }}"
|
|
||||||
vars:
|
|
||||||
timesync_ntp_servers:
|
|
||||||
- hostname: 2.pool.ntp.org
|
|
||||||
pool: yes
|
|
||||||
iburst: yes
|
|
||||||
roles:
|
|
||||||
- linux-system-roles.timesync
|
|
File diff suppressed because it is too large
Load Diff
@ -1,362 +0,0 @@
|
|||||||
From e658f6f0e7906d220027c9a36bf16398fdca1564 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Rich Megginson <rmeggins@redhat.com>
|
|
||||||
Date: Mon, 22 Mar 2021 13:45:01 -0600
|
|
||||||
Subject: [PATCH] add service cleanup for downstream testing
|
|
||||||
|
|
||||||
---
|
|
||||||
tests/get_services_state.yml | 4 ++++
|
|
||||||
tests/restore_services_state.yml | 23 +++++++++++++++++++++++
|
|
||||||
tests/tests_default.yml | 10 ++++++++++
|
|
||||||
tests/tests_default_wrapper.yml | 9 +++++++++
|
|
||||||
tests/tests_ntp.yml | 10 ++++++++++
|
|
||||||
tests/tests_ntp_provider1.yml | 8 ++++++++
|
|
||||||
tests/tests_ntp_provider2.yml | 8 ++++++++
|
|
||||||
tests/tests_ntp_provider3.yml | 8 ++++++++
|
|
||||||
tests/tests_ntp_provider4.yml | 8 ++++++++
|
|
||||||
tests/tests_ntp_provider5.yml | 8 ++++++++
|
|
||||||
tests/tests_ntp_provider6.yml | 8 ++++++++
|
|
||||||
tests/tests_ntp_ptp.yml | 10 ++++++++++
|
|
||||||
tests/tests_ptp_multi.yml | 11 +++++++++++
|
|
||||||
tests/tests_ptp_single.yml | 11 +++++++++++
|
|
||||||
14 files changed, 136 insertions(+)
|
|
||||||
create mode 100644 tests/get_services_state.yml
|
|
||||||
create mode 100644 tests/restore_services_state.yml
|
|
||||||
|
|
||||||
diff --git a/tests/get_services_state.yml b/tests/get_services_state.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..4fe5d36
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/get_services_state.yml
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+- name: Get initial state of services
|
|
||||||
+ tags: tests::cleanup
|
|
||||||
+ service_facts:
|
|
||||||
+ register: initial_state
|
|
||||||
diff --git a/tests/restore_services_state.yml b/tests/restore_services_state.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..9cc9768
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/restore_services_state.yml
|
|
||||||
@@ -0,0 +1,23 @@
|
|
||||||
+- name: Get final state of services
|
|
||||||
+ tags: tests::cleanup
|
|
||||||
+ service_facts:
|
|
||||||
+ register: final_state
|
|
||||||
+
|
|
||||||
+- name: Restore state of services
|
|
||||||
+ tags: tests::cleanup
|
|
||||||
+ service:
|
|
||||||
+ name: "{{ item }}"
|
|
||||||
+ state: "{{
|
|
||||||
+ 'started'
|
|
||||||
+ if initial_state.ansible_facts.services[item + '.service']['state'] == 'running'
|
|
||||||
+ else 'stopped'
|
|
||||||
+ }}"
|
|
||||||
+ when:
|
|
||||||
+ - item + '.service' in final_state.ansible_facts.services
|
|
||||||
+ - item + '.service' in initial_state.ansible_facts.services
|
|
||||||
+ with_items:
|
|
||||||
+ - chronyd
|
|
||||||
+ - ntpd
|
|
||||||
+ - ptp4l
|
|
||||||
+ - phc2sys
|
|
||||||
+ - timemaster
|
|
||||||
diff --git a/tests/tests_default.yml b/tests/tests_default.yml
|
|
||||||
index 9dc0e4c..61c1ea8 100644
|
|
||||||
--- a/tests/tests_default.yml
|
|
||||||
+++ b/tests/tests_default.yml
|
|
||||||
@@ -3,3 +3,13 @@
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- linux-system-roles.timesync
|
|
||||||
+
|
|
||||||
+ pre_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
+ post_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
diff --git a/tests/tests_default_wrapper.yml b/tests/tests_default_wrapper.yml
|
|
||||||
index 3090259..98be26f 100644
|
|
||||||
--- a/tests/tests_default_wrapper.yml
|
|
||||||
+++ b/tests/tests_default_wrapper.yml
|
|
||||||
@@ -1,4 +1,7 @@
|
|
||||||
- name: Create static inventory from hostvars
|
|
||||||
+ tags:
|
|
||||||
+# - 'tests::tier1'
|
|
||||||
+ - 'tests::slow'
|
|
||||||
hosts: all
|
|
||||||
tasks:
|
|
||||||
- name: create temporary file
|
|
||||||
@@ -15,9 +18,15 @@
|
|
||||||
delegate_to: localhost
|
|
||||||
|
|
||||||
- name: Run tests_default.yml normally
|
|
||||||
+ tags:
|
|
||||||
+# - 'tests::tier1'
|
|
||||||
+ - 'tests::slow'
|
|
||||||
import_playbook: tests_default.yml
|
|
||||||
|
|
||||||
- name: Run tests_default.yml in check_mode
|
|
||||||
+ tags:
|
|
||||||
+# - 'tests::tier1'
|
|
||||||
+ - 'tests::slow'
|
|
||||||
hosts: all
|
|
||||||
tasks:
|
|
||||||
- name: Run ansible-playbook with tests_default.yml in check mode
|
|
||||||
diff --git a/tests/tests_ntp.yml b/tests/tests_ntp.yml
|
|
||||||
index 9f39d24..c5768f4 100644
|
|
||||||
--- a/tests/tests_ntp.yml
|
|
||||||
+++ b/tests/tests_ntp.yml
|
|
||||||
@@ -20,6 +20,11 @@
|
|
||||||
roles:
|
|
||||||
- linux-system-roles.timesync
|
|
||||||
|
|
||||||
+ pre_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
tasks:
|
|
||||||
- block:
|
|
||||||
- meta: flush_handlers
|
|
||||||
@@ -67,3 +72,8 @@
|
|
||||||
__timesync_chrony_version is version('3.1', '>=')
|
|
||||||
when: chrony_conf is defined
|
|
||||||
tags: tests::verify
|
|
||||||
+
|
|
||||||
+ post_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
diff --git a/tests/tests_ntp_provider1.yml b/tests/tests_ntp_provider1.yml
|
|
||||||
index 988330a..e231b18 100644
|
|
||||||
--- a/tests/tests_ntp_provider1.yml
|
|
||||||
+++ b/tests/tests_ntp_provider1.yml
|
|
||||||
@@ -7,6 +7,10 @@
|
|
||||||
- linux-system-roles.timesync
|
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
- block:
|
|
||||||
- name: Remove NTP providers
|
|
||||||
package: name={{ item }} state=absent
|
|
||||||
@@ -31,3 +35,7 @@
|
|
||||||
that:
|
|
||||||
- "'172.16.123.1' in sources.stdout"
|
|
||||||
tags: tests::verify
|
|
||||||
+
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
diff --git a/tests/tests_ntp_provider2.yml b/tests/tests_ntp_provider2.yml
|
|
||||||
index 5a6284f..cf3e2a7 100644
|
|
||||||
--- a/tests/tests_ntp_provider2.yml
|
|
||||||
+++ b/tests/tests_ntp_provider2.yml
|
|
||||||
@@ -7,6 +7,10 @@
|
|
||||||
- linux-system-roles.timesync
|
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
- block:
|
|
||||||
- name: Remove ntp
|
|
||||||
package: name=ntp state=absent
|
|
||||||
@@ -33,3 +37,7 @@
|
|
||||||
- name: Check chronyd service
|
|
||||||
shell: chronyc -n tracking
|
|
||||||
tags: tests::verify
|
|
||||||
+
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
diff --git a/tests/tests_ntp_provider3.yml b/tests/tests_ntp_provider3.yml
|
|
||||||
index d5117de..4b88991 100644
|
|
||||||
--- a/tests/tests_ntp_provider3.yml
|
|
||||||
+++ b/tests/tests_ntp_provider3.yml
|
|
||||||
@@ -7,6 +7,10 @@
|
|
||||||
- linux-system-roles.timesync
|
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
- block:
|
|
||||||
- name: Remove chrony
|
|
||||||
package: name=chrony state=absent
|
|
||||||
@@ -33,3 +37,7 @@
|
|
||||||
- name: Check ntpd service
|
|
||||||
shell: ntpq -c rv | grep 'associd=0'
|
|
||||||
tags: tests::verify
|
|
||||||
+
|
|
||||||
+ - name: Import tasks
|
|
||||||
+ tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
diff --git a/tests/tests_ntp_provider4.yml b/tests/tests_ntp_provider4.yml
|
|
||||||
index c4e33c7..2e030c3 100644
|
|
||||||
--- a/tests/tests_ntp_provider4.yml
|
|
||||||
+++ b/tests/tests_ntp_provider4.yml
|
|
||||||
@@ -8,6 +8,10 @@
|
|
||||||
- linux-system-roles.timesync
|
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
- block:
|
|
||||||
- name: Install chrony
|
|
||||||
package: name=chrony state=present
|
|
||||||
@@ -31,3 +35,7 @@
|
|
||||||
- name: Check chronyd service
|
|
||||||
shell: chronyc -n tracking
|
|
||||||
tags: tests::verify
|
|
||||||
+
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
diff --git a/tests/tests_ntp_provider5.yml b/tests/tests_ntp_provider5.yml
|
|
||||||
index 09a855a..a4fbc2d 100644
|
|
||||||
--- a/tests/tests_ntp_provider5.yml
|
|
||||||
+++ b/tests/tests_ntp_provider5.yml
|
|
||||||
@@ -8,6 +8,10 @@
|
|
||||||
- linux-system-roles.timesync
|
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
- block:
|
|
||||||
- name: Install ntp
|
|
||||||
package: name=ntp state=present
|
|
||||||
@@ -31,3 +35,7 @@
|
|
||||||
- name: Check ntpd service
|
|
||||||
shell: ntpq -c rv | grep 'associd=0'
|
|
||||||
tags: tests::verify
|
|
||||||
+
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
diff --git a/tests/tests_ntp_provider6.yml b/tests/tests_ntp_provider6.yml
|
|
||||||
index 346b96a..31b55a1 100644
|
|
||||||
--- a/tests/tests_ntp_provider6.yml
|
|
||||||
+++ b/tests/tests_ntp_provider6.yml
|
|
||||||
@@ -7,6 +7,10 @@
|
|
||||||
both_avail: true
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
- block:
|
|
||||||
- name: Check for availability of both NTP providers
|
|
||||||
package: name={{ item }} state=present
|
|
||||||
@@ -81,3 +85,7 @@
|
|
||||||
when:
|
|
||||||
- not is_ntp_default
|
|
||||||
tags: tests::verify
|
|
||||||
+
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
diff --git a/tests/tests_ntp_ptp.yml b/tests/tests_ntp_ptp.yml
|
|
||||||
index 56079a3..fba330d 100644
|
|
||||||
--- a/tests/tests_ntp_ptp.yml
|
|
||||||
+++ b/tests/tests_ntp_ptp.yml
|
|
||||||
@@ -21,6 +21,11 @@
|
|
||||||
roles:
|
|
||||||
- linux-system-roles.timesync
|
|
||||||
|
|
||||||
+ pre_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
tasks:
|
|
||||||
- block:
|
|
||||||
- meta: flush_handlers
|
|
||||||
@@ -49,3 +54,8 @@
|
|
||||||
|
|
||||||
when: "'SOF_TIMESTAMPING_TX_' in ethtool.stdout"
|
|
||||||
tags: tests::verify
|
|
||||||
+
|
|
||||||
+ post_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
diff --git a/tests/tests_ptp_multi.yml b/tests/tests_ptp_multi.yml
|
|
||||||
index 1d1cd8e..02b44cb 100644
|
|
||||||
--- a/tests/tests_ptp_multi.yml
|
|
||||||
+++ b/tests/tests_ptp_multi.yml
|
|
||||||
@@ -1,4 +1,5 @@
|
|
||||||
- name: Configure time synchronization with multiple PTP domains
|
|
||||||
+ tags: tests::expfail
|
|
||||||
hosts: all
|
|
||||||
vars:
|
|
||||||
timesync_ptp_domains:
|
|
||||||
@@ -15,6 +16,11 @@
|
|
||||||
roles:
|
|
||||||
- linux-system-roles.timesync
|
|
||||||
|
|
||||||
+ pre_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
tasks:
|
|
||||||
- block:
|
|
||||||
- meta: flush_handlers
|
|
||||||
@@ -61,3 +67,8 @@
|
|
||||||
|
|
||||||
when: "'SOF_TIMESTAMPING_TX_' in ethtool.stdout"
|
|
||||||
tags: tests::verify
|
|
||||||
+
|
|
||||||
+ post_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
diff --git a/tests/tests_ptp_single.yml b/tests/tests_ptp_single.yml
|
|
||||||
index c7ba401..b96c34c 100644
|
|
||||||
--- a/tests/tests_ptp_single.yml
|
|
||||||
+++ b/tests/tests_ptp_single.yml
|
|
||||||
@@ -1,4 +1,5 @@
|
|
||||||
- name: Configure time synchronization with single PTP domain
|
|
||||||
+ tags: tests::expfail
|
|
||||||
hosts: all
|
|
||||||
vars:
|
|
||||||
timesync_ptp_domains:
|
|
||||||
@@ -7,6 +8,11 @@
|
|
||||||
roles:
|
|
||||||
- linux-system-roles.timesync
|
|
||||||
|
|
||||||
+ pre_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: get_services_state.yml
|
|
||||||
+
|
|
||||||
tasks:
|
|
||||||
- block:
|
|
||||||
- meta: flush_handlers
|
|
||||||
@@ -32,3 +38,8 @@
|
|
||||||
|
|
||||||
when: "'SOF_TIMESTAMPING_TX_' in ethtool.stdout"
|
|
||||||
tags: tests::verify
|
|
||||||
+
|
|
||||||
+ post_tasks:
|
|
||||||
+ - name: Import tasks
|
|
||||||
+# tags: tests::tier1::cleanup
|
|
||||||
+ import_tasks: restore_services_state.yml
|
|
||||||
--
|
|
||||||
2.30.2
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user