From 799866de2b75ec843b6aae64843c2531ea2254e4 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 1 Apr 2021 22:58:29 +0200 Subject: [PATCH] rebase timesync role to latest upstream Rebase to latest upstream (1937938) timesync - add timesync_chrony_custom_settings variable for free-form local configs (1938023) do not use ignore_errors in timesync role (1938014) support for timesync_max_distance to configure maxdistance/maxdist parameter (1938016) support for ntp xleave, filter, and hw timestamping (1938020) Related: rhbz#1961404 --- linux-system-roles.spec | 4 +- timesync-ansible-test-issues.diff | 22 --- timesync-tier1-tags.diff | 239 +++++++++++++++++------------- 3 files changed, 134 insertions(+), 131 deletions(-) delete mode 100644 timesync-ansible-test-issues.diff diff --git a/linux-system-roles.spec b/linux-system-roles.spec index ac7a9d8..032a9bb 100644 --- a/linux-system-roles.spec +++ b/linux-system-roles.spec @@ -105,7 +105,7 @@ BuildRequires: ansible >= 2.9.10 %global rolename2 selinux %deftag 2 1.1.1 -%defcommit 3 924650d0cd4117f73a7f0413ab745a8632bc5cec +%defcommit 3 8a95989e158519ce4bebe10091c47ef88b29261b %global rolename3 timesync #%%deftag 3 1.0.0 @@ -195,7 +195,6 @@ Patch22: selinux-bz-1926947-no-variable-named-present.diff Patch23: selinux-ansible-test-issues.diff Patch31: timesync-tier1-tags.diff -Patch32: timesync-ansible-test-issues.diff Patch41: rhel-system-roles-kdump-pr22.diff Patch42: kdump-tier1-tags.diff @@ -281,7 +280,6 @@ cd %{rolename2} cd .. cd %{rolename3} %patch31 -p1 -%patch32 -p1 cd .. cd %{rolename4} %patch41 -p1 diff --git a/timesync-ansible-test-issues.diff b/timesync-ansible-test-issues.diff deleted file mode 100644 index 2ec733a..0000000 --- a/timesync-ansible-test-issues.diff +++ /dev/null @@ -1,22 +0,0 @@ -From b55af45842482768f29704d90a1e019ffe0f7770 Mon Sep 17 00:00:00 2001 -From: Noriko Hosoi -Date: Tue, 2 Mar 2021 13:39:19 -0800 -Subject: [PATCH] Patch32: timesync-ansible-test-issues.diff - -RHELPLAN-68118 - Collections - Timesync - fixing ansible-test errors -RHELPLAN-68789 - Collections - ignore file for each role ---- - .sanity-ansible-ignore-2.9.txt | 1 + - 1 file changed, 1 insertion(+) - create mode 100644 .sanity-ansible-ignore-2.9.txt - -diff --git a/.sanity-ansible-ignore-2.9.txt b/.sanity-ansible-ignore-2.9.txt -new file mode 100644 -index 0000000..e6d5e4d ---- /dev/null -+++ b/.sanity-ansible-ignore-2.9.txt -@@ -0,0 +1 @@ -+plugins/modules/timesync_provider.sh shebang --- -2.26.2 - diff --git a/timesync-tier1-tags.diff b/timesync-tier1-tags.diff index 3abd22d..7d4d8eb 100644 --- a/timesync-tier1-tags.diff +++ b/timesync-tier1-tags.diff @@ -1,3 +1,27 @@ +From e658f6f0e7906d220027c9a36bf16398fdca1564 Mon Sep 17 00:00:00 2001 +From: Rich Megginson +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 @@ -10,10 +34,10 @@ index 0000000..4fe5d36 + register: initial_state diff --git a/tests/restore_services_state.yml b/tests/restore_services_state.yml new file mode 100644 -index 0000000..3d48975 +index 0000000..9cc9768 --- /dev/null +++ b/tests/restore_services_state.yml -@@ -0,0 +1,19 @@ +@@ -0,0 +1,23 @@ +- name: Get final state of services + tags: tests::cleanup + service_facts: @@ -23,10 +47,14 @@ index 0000000..3d48975 + tags: tests::cleanup + service: + name: "{{ item }}" -+ state: "{{ 'started' if initial_state.ansible_facts.services[item + '.service']['state'] == 'running' else 'stopped' }}" ++ 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 ++ - item + '.service' in final_state.ansible_facts.services ++ - item + '.service' in initial_state.ansible_facts.services + with_items: + - chronyd + - ntpd @@ -34,11 +62,10 @@ index 0000000..3d48975 + - phc2sys + - timemaster diff --git a/tests/tests_default.yml b/tests/tests_default.yml -index 856ebe5..fb298c9 100644 +index 9dc0e4c..61c1ea8 100644 --- a/tests/tests_default.yml +++ b/tests/tests_default.yml -@@ -3,4 +4,14 @@ - hosts: all +@@ -3,3 +3,13 @@ roles: - linux-system-roles.timesync @@ -53,11 +80,10 @@ index 856ebe5..fb298c9 100644 +# 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 a768f4c..b0c0ab3 100644 +index 3090259..98be26f 100644 --- a/tests/tests_default_wrapper.yml +++ b/tests/tests_default_wrapper.yml -@@ -1,5 +1,8 @@ - --- +@@ -1,4 +1,7 @@ - name: Create static inventory from hostvars + tags: +# - 'tests::tier1' @@ -65,8 +91,8 @@ index a768f4c..b0c0ab3 100644 hosts: all tasks: - name: create temporary file -@@ -17,9 +20,15 @@ - +@@ -15,9 +18,15 @@ + delegate_to: localhost - name: Run tests_default.yml normally + tags: @@ -82,10 +108,10 @@ index a768f4c..b0c0ab3 100644 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 e4b1b5e..446f1dc 100644 +index 9f39d24..c5768f4 100644 --- a/tests/tests_ntp.yml +++ b/tests/tests_ntp.yml -@@ -18,6 +19,11 @@ +@@ -20,6 +20,11 @@ roles: - linux-system-roles.timesync @@ -95,22 +121,22 @@ index e4b1b5e..446f1dc 100644 + import_tasks: get_services_state.yml + tasks: - - meta: flush_handlers - -@@ -35,3 +41,8 @@ - - "'172.16.123.1' in sources.stdout" - - "'172.16.123.2' in sources.stdout" - - "'172.16.123.3' in sources.stdout" + - 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 08ecab9..9fe0db3 100644 +index 988330a..e231b18 100644 --- a/tests/tests_ntp_provider1.yml +++ b/tests/tests_ntp_provider1.yml -@@ -8,6 +9,10 @@ +@@ -7,6 +7,10 @@ - linux-system-roles.timesync pre_tasks: @@ -118,22 +144,22 @@ index 08ecab9..9fe0db3 100644 +# tags: tests::tier1::cleanup + import_tasks: get_services_state.yml + - - name: Remove NTP providers - package: name={{ item }} state=absent - with_items: -@@ -27,3 +32,7 @@ - assert: - that: - - "'172.16.123.1' in sources.stdout" + - 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 5476ae4..e0d5c96 100644 +index 5a6284f..cf3e2a7 100644 --- a/tests/tests_ntp_provider2.yml +++ b/tests/tests_ntp_provider2.yml -@@ -8,6 +9,10 @@ +@@ -7,6 +7,10 @@ - linux-system-roles.timesync pre_tasks: @@ -141,22 +167,22 @@ index 5476ae4..e0d5c96 100644 +# tags: tests::tier1::cleanup + import_tasks: get_services_state.yml + - - name: Remove ntp - package: name=ntp state=absent - -@@ -29,3 +34,7 @@ - - - name: Check chronyd service - shell: chronyc -n tracking + - 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 44ca101..d440a64 100644 +index d5117de..4b88991 100644 --- a/tests/tests_ntp_provider3.yml +++ b/tests/tests_ntp_provider3.yml -@@ -8,6 +9,10 @@ +@@ -7,6 +7,10 @@ - linux-system-roles.timesync pre_tasks: @@ -164,22 +190,22 @@ index 44ca101..d440a64 100644 +# tags: tests::tier1::cleanup + import_tasks: get_services_state.yml + - - name: Remove chrony - package: name=chrony state=absent - -@@ -29,3 +34,7 @@ - - - name: Check ntpd service - shell: ntpq -c rv | grep 'associd=0' + - 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 8b452b8..8bccba0 100644 +index c4e33c7..2e030c3 100644 --- a/tests/tests_ntp_provider4.yml +++ b/tests/tests_ntp_provider4.yml -@@ -9,6 +10,10 @@ +@@ -8,6 +8,10 @@ - linux-system-roles.timesync pre_tasks: @@ -187,22 +213,22 @@ index 8b452b8..8bccba0 100644 +# tags: tests::tier1::cleanup + import_tasks: get_services_state.yml + - - name: Install chrony - package: name=chrony state=present - register: package_install -@@ -27,3 +32,7 @@ - - - name: Check chronyd service - shell: chronyc -n tracking + - 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 1740164..98a054f 100644 +index 09a855a..a4fbc2d 100644 --- a/tests/tests_ntp_provider5.yml +++ b/tests/tests_ntp_provider5.yml -@@ -9,6 +10,10 @@ +@@ -8,6 +8,10 @@ - linux-system-roles.timesync pre_tasks: @@ -210,45 +236,45 @@ index 1740164..98a054f 100644 +# tags: tests::tier1::cleanup + import_tasks: get_services_state.yml + - - name: Install ntp - package: name=ntp state=present - register: package_install -@@ -27,3 +32,7 @@ - - - name: Check ntpd service - shell: ntpq -c rv | grep 'associd=0' + - 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 21a2039..fb41824 100644 +index 346b96a..31b55a1 100644 --- a/tests/tests_ntp_provider6.yml +++ b/tests/tests_ntp_provider6.yml -@@ -6,6 +7,10 @@ +@@ -7,6 +7,10 @@ both_avail: true tasks: -+ - name: Import tasks -+# tags: tests::tier1::cleanup -+ import_tasks: get_services_state.yml ++ - name: Import tasks ++# tags: tests::tier1::cleanup ++ import_tasks: get_services_state.yml + - - name: Check for availability of both NTP providers - package: name={{ item }} state=present - register: package_install -@@ -71,3 +76,7 @@ - shell: chronyc -n tracking - when: - - not is_ntp_default + - 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 ++ - 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 cab706f..7f4cdfc 100644 +index 56079a3..fba330d 100644 --- a/tests/tests_ntp_ptp.yml +++ b/tests/tests_ntp_ptp.yml -@@ -22,6 +23,11 @@ +@@ -21,6 +21,11 @@ roles: - linux-system-roles.timesync @@ -258,29 +284,28 @@ index cab706f..7f4cdfc 100644 + import_tasks: get_services_state.yml + tasks: - - meta: flush_handlers + - block: + - meta: flush_handlers +@@ -49,3 +54,8 @@ -@@ -48,3 +54,8 @@ - - "'PTP1' in sources.stdout" - - when: "'SOF_TIMESTAMPING_TX_' in ethtool.stdout" + 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 d52d439..936e467 100644 +index 1d1cd8e..02b44cb 100644 --- a/tests/tests_ptp_multi.yml +++ b/tests/tests_ptp_multi.yml -@@ -1,5 +1,6 @@ - +@@ -1,4 +1,5 @@ - name: Configure time synchronization with multiple PTP domains + tags: tests::expfail hosts: all vars: timesync_ptp_domains: -@@ -16,6 +17,11 @@ +@@ -15,6 +16,11 @@ roles: - linux-system-roles.timesync @@ -290,29 +315,28 @@ index d52d439..936e467 100644 + import_tasks: get_services_state.yml + tasks: - - meta: flush_handlers + - block: + - meta: flush_handlers +@@ -61,3 +67,8 @@ -@@ -58,3 +64,8 @@ - - "'domainNumber 1' in pmc.stdout" - - when: "'SOF_TIMESTAMPING_TX_' in ethtool.stdout" + 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 74da310..36d141e 100644 +index c7ba401..b96c34c 100644 --- a/tests/tests_ptp_single.yml +++ b/tests/tests_ptp_single.yml -@@ -1,5 +1,6 @@ - +@@ -1,4 +1,5 @@ - name: Configure time synchronization with single PTP domain + tags: tests::expfail hosts: all vars: timesync_ptp_domains: -@@ -8,6 +9,11 @@ +@@ -7,6 +8,11 @@ roles: - linux-system-roles.timesync @@ -322,14 +346,17 @@ index 74da310..36d141e 100644 + import_tasks: get_services_state.yml + tasks: - - meta: flush_handlers + - block: + - meta: flush_handlers +@@ -32,3 +38,8 @@ -@@ -31,3 +37,8 @@ - - "'domainNumber 3' in pmc.stdout" - - when: "'SOF_TIMESTAMPING_TX_' in ethtool.stdout" + 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 +