From 90633b58e1095edfa3360cf8a275a26cc52f2d70 Mon Sep 17 00:00:00 2001 From: Sergei Petrosian Date: Fri, 24 Jan 2025 14:15:56 +0100 Subject: [PATCH 1/2] ci: Replace woke with codespell woke has been left with Noriko's and all other PRs not being reviewed for years, hence we have been using our fork. https://github.com/get-woke/woke/pull/252 woke has a limitation that doesn't allow ignoring lines of code, codespell allows for this. Replacing woke with codespell that provides a dictionary for replacing phrasing with recommended terms: https://github.com/codespell-project/codespell/blob/main/codespell_lib/data/dictionary_usage.txt It also supports using custom dictionaries so we can add to the list if we want For more information about inclusive naming initiative, see https://inclusivenaming.org/about/ Codespell also checks spelling, which is an advantage for system roles because a big part of our code is user-facing - task names, debug messages, readmes. `ignore-multiline-regex` in the `.codespellrc` config allows for disabling codespell for a block of lines: ``` # codespell:ignore-begin ... codespell will not look at this text. # codespell:ignore-end ``` Signed-off-by: Sergei Petrosian --- .ansible-lint | 2 +- .codespellrc | 5 +++++ .github/workflows/ansible-test.yml | 2 +- .github/workflows/codespell.yml | 18 ++++++++++++++++++ .github/workflows/woke.yml | 20 -------------------- README.md | 2 +- 6 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 .codespellrc create mode 100644 .github/workflows/codespell.yml delete mode 100644 .github/workflows/woke.yml diff --git a/.ansible-lint b/.ansible-lint index e8a0ccc..5ac02b9 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -17,7 +17,7 @@ kinds: skip_list: - fqcn-builtins - var-naming[no-role-prefix] - - sanity[cannot-ignore] # wokeignore:rule=sanity + - sanity[cannot-ignore] exclude_paths: - tests/roles/ - .github/ diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000..8fab288 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,5 @@ +[codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = tests,artifacts*,pylintrc +builtin = usage +ignore-multiline-regex = codespell:ignore-begin.*codespell:ignore-end diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 4dbdaa2..c9868a2 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -43,6 +43,6 @@ jobs: - name: Run ansible-test uses: ansible-community/ansible-test-gh-action@release/v1 with: - testing-type: sanity # wokeignore:rule=sanity + testing-type: sanity ansible-core-version: stable-2.17 collection-src-directory: ${{ github.workspace }}/.tox/ansible_collections/${{ env.LSR_ROLE2COLL_NAMESPACE }}/${{ env.LSR_ROLE2COLL_NAME }} diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000..e1251d6 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,18 @@ +# Codespell configuration is within .codespellrc +--- +name: Codespell +on: # yamllint disable-line rule:truthy + - pull_request +permissions: + contents: read +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Annotate locations with typos + uses: codespell-project/codespell-problem-matcher@v1 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/.github/workflows/woke.yml b/.github/workflows/woke.yml deleted file mode 100644 index 4cded0d..0000000 --- a/.github/workflows/woke.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -# yamllint disable rule:line-length -name: Woke -on: # yamllint disable-line rule:truthy - - pull_request -jobs: - woke: - name: Detect non-inclusive language - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Run lsr-woke-action - # Originally, uses: get-woke/woke-action@v0 - uses: linux-system-roles/lsr-woke-action@main - with: - woke-args: "-c https://raw.githubusercontent.com/linux-system-roles/tox-lsr/main/src/tox_lsr/config_files/woke.yml --count-only-error-for-failure" - # Cause the check to fail on any broke rules - fail-on-error: true diff --git a/README.md b/README.md index afe7c43..d65fc56 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # timesync -[![ansible-lint.yml](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-lint.yml) [![ansible-test.yml](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-test.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-test.yml) [![markdownlint.yml](https://github.com/linux-system-roles/timesync/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/markdownlint.yml) [![shellcheck.yml](https://github.com/linux-system-roles/timesync/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/shellcheck.yml) [![tft.yml](https://github.com/linux-system-roles/timesync/actions/workflows/tft.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/tft.yml) [![tft_citest_bad.yml](https://github.com/linux-system-roles/timesync/actions/workflows/tft_citest_bad.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/tft_citest_bad.yml) [![woke.yml](https://github.com/linux-system-roles/timesync/actions/workflows/woke.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/woke.yml) +[![ansible-lint.yml](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-lint.yml) [![ansible-test.yml](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-test.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-test.yml) [![codespell.yml](https://github.com/linux-system-roles/timesync/actions/workflows/codespell.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/codespell.yml) [![markdownlint.yml](https://github.com/linux-system-roles/timesync/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/markdownlint.yml) [![shellcheck.yml](https://github.com/linux-system-roles/timesync/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/shellcheck.yml) [![tft.yml](https://github.com/linux-system-roles/timesync/actions/workflows/tft.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/tft.yml) [![tft_citest_bad.yml](https://github.com/linux-system-roles/timesync/actions/workflows/tft_citest_bad.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/tft_citest_bad.yml) This role installs and configures an NTP and/or PTP implementation to operate From 9644d51a7596c71218294cf60374f5598532df88 Mon Sep 17 00:00:00 2001 From: Sergei Petrosian Date: Fri, 24 Jan 2025 15:06:12 +0100 Subject: [PATCH 2/2] Remove woke ignores and fix codespell --- README.md | 6 +----- handlers/main.yml | 2 -- tasks/main.yml | 10 ---------- templates/ptp4l.conf.j2 | 1 - templates/timemaster.conf.j2 | 1 - vars/Debian.yml | 1 - vars/RedHat_10.yml | 1 - vars/RedHat_6.yml | 1 - vars/RedHat_7.yml | 1 - vars/RedHat_8.yml | 1 - vars/RedHat_9.yml | 1 - vars/SL-Micro.yml | 1 - vars/default.yml | 1 - 13 files changed, 1 insertion(+), 27 deletions(-) diff --git a/README.md b/README.md index d65fc56..03885d1 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,7 @@ [![ansible-lint.yml](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-lint.yml) [![ansible-test.yml](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-test.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-test.yml) [![codespell.yml](https://github.com/linux-system-roles/timesync/actions/workflows/codespell.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/codespell.yml) [![markdownlint.yml](https://github.com/linux-system-roles/timesync/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/markdownlint.yml) [![shellcheck.yml](https://github.com/linux-system-roles/timesync/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/shellcheck.yml) [![tft.yml](https://github.com/linux-system-roles/timesync/actions/workflows/tft.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/tft.yml) [![tft_citest_bad.yml](https://github.com/linux-system-roles/timesync/actions/workflows/tft_citest_bad.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/tft_citest_bad.yml) This role installs and configures an NTP and/or PTP implementation to operate - -as an NTP client and/or PTP slave in order to synchronize the system clock with - +as an NTP client and/or PTP slave in order to synchronize the system clock with NTP servers and/or grandmasters in PTP domains. Supported NTP/PTP implementations are chrony, ntp (the reference implementation) and linuxptp. @@ -65,7 +63,6 @@ timesync_ptp_domains: - number: 0 # PTP domain number interfaces: [eth0] # List of interfaces in the domain delay: 0.000010 # Assumed maximum network delay to the - # grandmaster in seconds # wokeignore:rule=master # (default 100 microsecond) transport: UDPv4 # Network transport: UDPv4, UDPv6, L2 # (default UDPv4) @@ -143,7 +140,6 @@ Install and configure ntp to synchronize the system clock with three NTP servers ``` Install and configure linuxptp to synchronize the system clock with a - grandmaster in PTP domain number 0, which is accessible on interface eth0: ```yaml diff --git a/handlers/main.yml b/handlers/main.yml index f3b555d..12cd398 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -19,9 +19,7 @@ name: phc2sys state: restarted -# wokeignore:rule=master - name: Restart timemaster service: - # wokeignore:rule=master name: timemaster state: restarted diff --git a/tasks/main.yml b/tasks/main.yml index c4d331f..ee68c99 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -137,7 +137,6 @@ dest: "{{ timesync_chrony_conf_path }}" backup: true mode: "0644" - # wokeignore:rule=master notify: Restart {{ 'chronyd' if timesync_mode == 1 else 'timemaster' }} when: - timesync_mode != 2 @@ -162,7 +161,6 @@ dest: /etc/ntp.conf backup: true mode: "0644" - # wokeignore:rule=master notify: Restart {{ 'ntpd' if timesync_mode == 1 else 'timemaster' }} when: - timesync_mode != 2 @@ -217,16 +215,12 @@ - "'linuxptp' in ansible_facts.packages" - timesync_phc2sys_sysconfig_path | length > 0 -# wokeignore:rule=master - name: Generate timemaster.conf file template: - # wokeignore:rule=master src: timemaster.conf.j2 - # wokeignore:rule=master dest: "{{ timesync_timemaster_config_path }}" backup: true mode: "0644" - # wokeignore:rule=master notify: Restart timemaster when: - timesync_mode == 3 @@ -327,10 +321,8 @@ - not __disable_result.msg is match( 'Could not find the requested service phc2sys:') -# wokeignore:rule=master - name: Disable timemaster vars: - # wokeignore:rule=master __timemstr: timemaster service: name: "{{ __timemstr }}" @@ -379,10 +371,8 @@ - timesync_mode == 2 - timesync_mode2_hwts -# wokeignore:rule=master - name: Enable timemaster service: - # wokeignore:rule=master name: timemaster state: started enabled: true diff --git a/templates/ptp4l.conf.j2 b/templates/ptp4l.conf.j2 index e211573..bb3e11f 100644 --- a/templates/ptp4l.conf.j2 +++ b/templates/ptp4l.conf.j2 @@ -2,7 +2,6 @@ {{ "system_role:timesync" | comment(prefix="", postfix="") }} [global] -{# wokeignore:rule=slave #} slaveOnly 1 domainNumber {{ timesync_ptp_domains[0].number }} time_stamping {{ 'hardware' if timesync_mode2_hwts else 'software' }} diff --git a/templates/timemaster.conf.j2 b/templates/timemaster.conf.j2 index 66b5cd7..08d4140 100644 --- a/templates/timemaster.conf.j2 +++ b/templates/timemaster.conf.j2 @@ -18,7 +18,6 @@ ptp4l_option hybrid_e2e 1 {% endif %} {% endfor %} -{# wokeignore:rule=master #} [timemaster] ntp_program {{ 'ntpd' if timesync_ntp_provider == 'ntp' else 'chronyd' }} diff --git a/vars/Debian.yml b/vars/Debian.yml index b291bdd..90919ea 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony/chrony.conf" timesync_ntp_sysconfig_path: "/etc/default/ntp" timesync_ptp4l_sysconfig_path: "" timesync_phc2sys_sysconfig_path: "" -# wokeignore:rule=master timesync_timemaster_config_path: "/etc/linuxptp/timemaster.conf" diff --git a/vars/RedHat_10.yml b/vars/RedHat_10.yml index d6dd4cd..25186ac 100644 --- a/vars/RedHat_10.yml +++ b/vars/RedHat_10.yml @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf" timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys -# wokeignore:rule=master timesync_timemaster_config_path: /etc/timemaster.conf diff --git a/vars/RedHat_6.yml b/vars/RedHat_6.yml index 51e0fcb..e5d5cfb 100644 --- a/vars/RedHat_6.yml +++ b/vars/RedHat_6.yml @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf" timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys -# wokeignore:rule=master timesync_timemaster_config_path: /etc/timemaster.conf diff --git a/vars/RedHat_7.yml b/vars/RedHat_7.yml index cce3f05..f96d7e6 100644 --- a/vars/RedHat_7.yml +++ b/vars/RedHat_7.yml @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf" timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys -# wokeignore:rule=master timesync_timemaster_config_path: /etc/timemaster.conf diff --git a/vars/RedHat_8.yml b/vars/RedHat_8.yml index cce3f05..f96d7e6 100644 --- a/vars/RedHat_8.yml +++ b/vars/RedHat_8.yml @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf" timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys -# wokeignore:rule=master timesync_timemaster_config_path: /etc/timemaster.conf diff --git a/vars/RedHat_9.yml b/vars/RedHat_9.yml index d6dd4cd..25186ac 100644 --- a/vars/RedHat_9.yml +++ b/vars/RedHat_9.yml @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf" timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys -# wokeignore:rule=master timesync_timemaster_config_path: /etc/timemaster.conf diff --git a/vars/SL-Micro.yml b/vars/SL-Micro.yml index d6dd4cd..25186ac 100644 --- a/vars/SL-Micro.yml +++ b/vars/SL-Micro.yml @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf" timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys -# wokeignore:rule=master timesync_timemaster_config_path: /etc/timemaster.conf diff --git a/vars/default.yml b/vars/default.yml index cce3f05..f96d7e6 100644 --- a/vars/default.yml +++ b/vars/default.yml @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf" timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys -# wokeignore:rule=master timesync_timemaster_config_path: /etc/timemaster.conf