File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 137137- name : Activate GOST backends before the public SNI router
138138 ansible.builtin.meta : flush_handlers
139139
140- - name : Ensure GOST has loaded the current certificate
140+ - name : Check whether GOST predates the current certificate
141+ ansible.builtin.shell :
142+ cmd : >-
143+ test "{{ megaproxy_certificate_directory }}/fullchain.pem"
144+ -nt "/proc/$(systemctl show --property MainPID --value megaproxy-gost)"
145+ register : megaproxy_gost_certificate_is_newer
146+ changed_when : false
147+ failed_when : false
148+ when : not ansible_check_mode
149+
150+ - name : Load a newer certificate into GOST
141151 ansible.builtin.systemd_service :
142152 name : megaproxy-gost
143153 state : restarted
144154 daemon_reload : true
145- when : not ansible_check_mode
155+ when :
156+ - not ansible_check_mode
157+ - megaproxy_gost_certificate_is_newer.rc == 0
146158
147159- name : Install containerized certificate renewal service
148160 ansible.builtin.template :
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ launch_host() {
3333 sleep 2
3434 done
3535
36+ # GitHub-hosted runners may block plain HTTP from nested LXD guests.
37+ sudo lxc exec " $name " -- sh -c \
38+ " sed -i 's|http://|https://|g' /etc/apt/sources.list 2>/dev/null || true; sed -i 's|http://|https://|g' /etc/apt/sources.list.d/*.sources 2>/dev/null || true"
3639 sudo lxc exec " $name " -- apt-get update
3740 sudo lxc exec " $name " -- env DEBIAN_FRONTEND=noninteractive apt-get install -y python3 openssh-server sudo curl
3841 sudo lxc exec " $name " -- install -d -m 0700 /root/.ssh
Original file line number Diff line number Diff line change 33ROOT = Path (__file__ ).resolve ().parents [1 ]
44
55
6- def test_https_role_always_loads_the_current_certificate () -> None :
6+ def test_https_role_loads_a_certificate_newer_than_the_service () -> None :
77 tasks = (ROOT / "roles" / "https_proxy" / "tasks" / "main.yml" ).read_text (
88 encoding = "utf-8"
99 )
10- reload_task = tasks .split ("- name: Ensure GOST has loaded the current certificate " , 1 )[1 ].split (
10+ reload_task = tasks .split ("- name: Load a newer certificate into GOST " , 1 )[1 ].split (
1111 "- name: Install containerized certificate renewal service" , 1
1212 )[0 ]
1313
1414 assert "state: restarted" in reload_task
15- assert "when: not ansible_check_mode " in reload_task
15+ assert "megaproxy_gost_certificate_is_newer.rc == 0 " in reload_task
1616
1717
1818def test_domain_certificate_detects_openssl_textual_mismatch () -> None :
You can’t perform that action at this time.
0 commit comments