Fix check zone role for Jammy

Ubuntu Jammy installs the named-checkzone tool to
/usr/bin/named-checkzone, but old ubuntu installed to
/usr/sbin/named-checkzone. Rather than try and keep track of the
different locations we update the task to run under the shell module so
that we can rely on $PATH to do the heavy lifting for us.

To help ensure this doesn't break the old path and to catch problems
earlier I have also added testing across the debuntu set of platforms.
The role doesn't currently support other platforms as it relies on the
bind9utils package.

Change-Id: I1650b605cb6f25fa7585524b427d65d2fc291338
This commit is contained in:
Clark Boylan 2022-10-31 12:18:08 -07:00
parent 68f675f5a3
commit 5f3c90057c
4 changed files with 94 additions and 1 deletions

View File

@ -0,0 +1,18 @@
; -*- mode: zone -*-
$ORIGIN testing.test.
$TTL 1h
@ IN SOA adns1.testing.test. hostmaster.testing.test. (
1667422838 ; serial number unixtime
1h ; refresh (secondary checks for updates)
10m ; retry (secondary retries failed axfr)
10d ; expire (secondary ends serving old data)
5m ) ; min ttl (cache time for failed lookups)
@ IN NS ns1.testing.test.
@ IN A 127.0.0.1
@ IN AAAA ::1
adns1 IN A 127.0.0.1
adns1 IN AAAA ::1
ns1 IN A 127.0.0.1
ns1 IN AAAA ::1

View File

@ -9,7 +9,14 @@
when: not zone_db_files when: not zone_db_files
- name: 'Run checkzone' - name: 'Run checkzone'
command: '/usr/sbin/named-checkzone {{ zj_zone_db_file[0] }} {{ zj_zone_db_file[1] }}' # Use shell so that $PATH can be used to lookup the executable path.
# Jammy installs to /usr/bin but older releases install to /usr/sbin.
shell: |
# Explicitly add /usr/sbin to path in case it isnt already there.
export PATH=$PATH:/usr/sbin
named-checkzone {{ zj_zone_db_file[0] }} {{ zj_zone_db_file[1] }}
loop: "{{ zone_db_files }}" loop: "{{ zone_db_files }}"
loop_control: loop_control:
loop_var: zj_zone_db_file loop_var: zj_zone_db_file
tags:
- skip_ansible_lint

View File

@ -59,6 +59,7 @@ TAGS = {
'centos-platforms': CENTOS_PLATFORMS, 'centos-platforms': CENTOS_PLATFORMS,
'debian-platforms': DEBIAN_PLATFORMS, 'debian-platforms': DEBIAN_PLATFORMS,
'ubuntu-platforms': UBUNTU_PLATFORMS, 'ubuntu-platforms': UBUNTU_PLATFORMS,
'debuntu-platforms': UBUNTU_PLATFORMS + DEBIAN_PLATFORMS,
'all-platforms': ALL_PLATFORMS, 'all-platforms': ALL_PLATFORMS,
} }

View File

@ -388,6 +388,68 @@
netconsole_remote_ip: 192.0.2.1 netconsole_remote_ip: 192.0.2.1
netconsole_remote_port: 6666 netconsole_remote_port: 6666
- job:
name: zuul-jobs-test-validate-zone-db
description: Test the validate-zone-db role
tags: debuntu-platforms
files:
- ^roles/validate-zone-db/.*
run: test-playbooks/simple-role-test.yaml
vars:
role_name: validate-zone-db
zone_files:
- /home/zuul/src/opendev.org/zuul/zuul-jobs/roles/validate-zone-db/files/test_zones
- job:
name: zuul-jobs-test-validate-zone-db-debian-bullseye
description: Test the validate-zone-db role on debian-bullseye
parent: zuul-jobs-test-validate-zone-db
tags: auto-generated
nodeset:
nodes:
- name: debian-bullseye
label: debian-bullseye
- job:
name: zuul-jobs-test-validate-zone-db-debian-buster
description: Test the validate-zone-db role on debian-buster
parent: zuul-jobs-test-validate-zone-db
tags: auto-generated
nodeset:
nodes:
- name: debian-buster
label: debian-buster
- job:
name: zuul-jobs-test-validate-zone-db-ubuntu-bionic
description: Test the validate-zone-db role on ubuntu-bionic
parent: zuul-jobs-test-validate-zone-db
tags: auto-generated
nodeset:
nodes:
- name: ubuntu-bionic
label: ubuntu-bionic
- job:
name: zuul-jobs-test-validate-zone-db-ubuntu-focal
description: Test the validate-zone-db role on ubuntu-focal
parent: zuul-jobs-test-validate-zone-db
tags: auto-generated
nodeset:
nodes:
- name: ubuntu-focal
label: ubuntu-focal
- job:
name: zuul-jobs-test-validate-zone-db-ubuntu-jammy
description: Test the validate-zone-db role on ubuntu-jammy
parent: zuul-jobs-test-validate-zone-db
tags: auto-generated
nodeset:
nodes:
- name: ubuntu-jammy
label: ubuntu-jammy
- job: - job:
name: zuul-jobs-test-dstat-graph name: zuul-jobs-test-dstat-graph
description: Test the dstat-graph roles description: Test the dstat-graph roles
@ -832,6 +894,11 @@
- zuul-jobs-test-enable-fips - zuul-jobs-test-enable-fips
- zuul-jobs-test-ensure-bazelisk - zuul-jobs-test-ensure-bazelisk
- zuul-jobs-test-netconsole - zuul-jobs-test-netconsole
- zuul-jobs-test-validate-zone-db-debian-bullseye
- zuul-jobs-test-validate-zone-db-debian-buster
- zuul-jobs-test-validate-zone-db-ubuntu-bionic
- zuul-jobs-test-validate-zone-db-ubuntu-focal
- zuul-jobs-test-validate-zone-db-ubuntu-jammy
- zuul-jobs-test-dstat-graph-centos-7 - zuul-jobs-test-dstat-graph-centos-7
- zuul-jobs-test-dstat-graph-centos-8-stream - zuul-jobs-test-dstat-graph-centos-8-stream
- zuul-jobs-test-dstat-graph-centos-9-stream - zuul-jobs-test-dstat-graph-centos-9-stream