1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Clean up test entries from sysrc tests (#2330) (#2438)

* Clean up test entries from sysrc tests

* sysrc: enable tests

* sysrc: cache the files to be changed and restore them

* Update the ezjail archive host and remove obsolete file

* sysrc: set ezjail to use archives for 12.0 or less

* sysrc: Detect the version to use ftp vs ftp-archive using http

* sysrc: Skip ezjail test on FreeBSD 12.0

(cherry picked from commit 7007c68ab7)

Co-authored-by: David Lundgren <dlundgren@syberisle.net>
This commit is contained in:
patchback[bot] 2021-05-03 21:34:19 +02:00 committed by GitHub
parent 4d23b7a48b
commit 797ea23e50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 3 deletions

View file

@ -3,4 +3,3 @@ needs/root
skip/docker skip/docker
skip/osx skip/osx
skip/rhel skip/rhel
disabled # FIXME

View file

@ -6,7 +6,11 @@
block: block:
- name: Cache original contents of /etc/rc.conf - name: Cache original contents of /etc/rc.conf
shell: "cat /etc/rc.conf" shell: "cat /etc/rc.conf"
register: sysrc_original_content register: cached_etc_rcconf_content
- name: Cache original contents of /boot/loader.conf
shell: "cat /boot/loader.conf"
register: cached_boot_loaderconf_content
## ##
## sysrc - example - set mysqlpidfile ## sysrc - example - set mysqlpidfile
@ -130,6 +134,11 @@
## sysrc - example - Enable nginx in testjail ## sysrc - example - Enable nginx in testjail
## ##
- name: Test within jail - name: Test within jail
#
# NOTE: FreeBSD 12.0 test runner receives a "connection reset by peer" after ~20% downloaded so we are
# only running this on 12.1 or higher
#
when: ansible_distribution_version is version('12.01', '>=')
block: block:
- name: Setup testjail - name: Setup testjail
include: setup-testjail.yml include: setup-testjail.yml
@ -316,3 +325,13 @@
- not sysrc_value_absent_idempotent.changed - not sysrc_value_absent_idempotent.changed
- "'sysrc_delim=\"t1,t2\"' in sysrc_delim_content.stdout_lines" - "'sysrc_delim=\"t1,t2\"' in sysrc_delim_content.stdout_lines"
- "'sysrc_delim_delete' not in sysrc_delim_content.stdout_lines" - "'sysrc_delim_delete' not in sysrc_delim_content.stdout_lines"
always:
- name: Restore /etc/rc.conf
copy:
content: "{{ cached_etc_rcconf_content }}"
dest: /etc/rc.conf
- name: Restore /boot/loader.conf
copy:
content: "{{ cached_boot_loaderconf_content }}"
dest: /boot/loader.conf

View file

@ -17,12 +17,19 @@
pkgng: pkgng:
name: ezjail name: ezjail
- name: Configure ezjail to use http
when: ansible_distribution_version is version('11.01', '>')
lineinfile:
dest: /usr/local/etc/ezjail.conf
regexp: ^ezjail_ftphost
line: ezjail_ftphost=http://ftp.freebsd.org
- name: Configure ezjail to use archive for old freebsd releases - name: Configure ezjail to use archive for old freebsd releases
when: ansible_distribution_version is version('11.01', '<=') when: ansible_distribution_version is version('11.01', '<=')
lineinfile: lineinfile:
dest: /usr/local/etc/ezjail.conf dest: /usr/local/etc/ezjail.conf
regexp: ^ezjail_ftphost regexp: ^ezjail_ftphost
line: ezjail_ftphost=ftp-archive.freebsd.org line: ezjail_ftphost=http://ftp-archive.freebsd.org
- name: Start ezjail - name: Start ezjail
ignore_errors: yes ignore_errors: yes