mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #7541/b8ecb167 backport][stable-8] CI: devel supports Fedora 39, and no longer Fedora 38 (#7548)
CI: devel supports Fedora 39, and no longer Fedora 38 (#7541)
* devel supports Fedora 39, and no longer Fedora 38.
* Disable 'mail' tests for Python 3.12+.
Ref: https://github.com/ansible-collections/community.general/issues/4656
* Fix setupSSLServer to work with Python 3.12.
(cherry picked from commit b8ecb1671b
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
ea427d3c82
commit
c4bd7c2b7b
3 changed files with 104 additions and 90 deletions
|
@ -173,8 +173,8 @@ stages:
|
||||||
targets:
|
targets:
|
||||||
- name: Alpine 3.18
|
- name: Alpine 3.18
|
||||||
test: alpine/3.18
|
test: alpine/3.18
|
||||||
# - name: Fedora 38
|
# - name: Fedora 39
|
||||||
# test: fedora/38
|
# test: fedora/39
|
||||||
- name: Ubuntu 22.04
|
- name: Ubuntu 22.04
|
||||||
test: ubuntu/22.04
|
test: ubuntu/22.04
|
||||||
groups:
|
groups:
|
||||||
|
@ -267,8 +267,8 @@ stages:
|
||||||
parameters:
|
parameters:
|
||||||
testFormat: devel/linux/{0}
|
testFormat: devel/linux/{0}
|
||||||
targets:
|
targets:
|
||||||
- name: Fedora 38
|
- name: Fedora 39
|
||||||
test: fedora38
|
test: fedora39
|
||||||
- name: Ubuntu 20.04
|
- name: Ubuntu 20.04
|
||||||
test: ubuntu2004
|
test: ubuntu2004
|
||||||
- name: Ubuntu 22.04
|
- name: Ubuntu 22.04
|
||||||
|
@ -287,6 +287,8 @@ stages:
|
||||||
parameters:
|
parameters:
|
||||||
testFormat: 2.16/linux/{0}
|
testFormat: 2.16/linux/{0}
|
||||||
targets:
|
targets:
|
||||||
|
- name: Fedora 38
|
||||||
|
test: fedora38
|
||||||
- name: openSUSE 15
|
- name: openSUSE 15
|
||||||
test: opensuse15
|
test: opensuse15
|
||||||
groups:
|
groups:
|
||||||
|
|
|
@ -18,7 +18,14 @@ except ModuleNotFoundError:
|
||||||
from http.server import HTTPServer, SimpleHTTPRequestHandler
|
from http.server import HTTPServer, SimpleHTTPRequestHandler
|
||||||
|
|
||||||
httpd = HTTPServer(('localhost', port), SimpleHTTPRequestHandler)
|
httpd = HTTPServer(('localhost', port), SimpleHTTPRequestHandler)
|
||||||
httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True,
|
try:
|
||||||
|
httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True,
|
||||||
certfile=os.path.join(root_dir, 'cert.pem'),
|
certfile=os.path.join(root_dir, 'cert.pem'),
|
||||||
keyfile=os.path.join(root_dir, 'key.pem'))
|
keyfile=os.path.join(root_dir, 'key.pem'))
|
||||||
|
except AttributeError:
|
||||||
|
# Python 3.12 or newer:
|
||||||
|
context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
|
||||||
|
context.load_cert_chain(certfile=os.path.join(root_dir, 'cert.pem'),
|
||||||
|
keyfile=os.path.join(root_dir, 'key.pem'))
|
||||||
|
httpd.socket = context.wrap_socket(httpd.socket)
|
||||||
httpd.handle_request()
|
httpd.handle_request()
|
||||||
|
|
|
@ -10,15 +10,20 @@
|
||||||
|
|
||||||
# TODO: Our current implementation does not handle SMTP authentication
|
# TODO: Our current implementation does not handle SMTP authentication
|
||||||
|
|
||||||
# NOTE: If the system does not support smtpd-tls (python 2.6 and older) we do basic tests
|
- when:
|
||||||
- name: Attempt to install smtpd-tls
|
# TODO: https://github.com/ansible-collections/community.general/issues/4656
|
||||||
|
- ansible_python.version.major != 3 or ansible_python.version.minor < 12
|
||||||
|
block:
|
||||||
|
|
||||||
|
# NOTE: If the system does not support smtpd-tls (python 2.6 and older) we do basic tests
|
||||||
|
- name: Attempt to install smtpd-tls
|
||||||
pip:
|
pip:
|
||||||
name: smtpd-tls
|
name: smtpd-tls
|
||||||
state: present
|
state: present
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: smtpd_tls
|
register: smtpd_tls
|
||||||
|
|
||||||
- name: Install test smtpserver
|
- name: Install test smtpserver
|
||||||
copy:
|
copy:
|
||||||
src: '{{ item }}'
|
src: '{{ item }}'
|
||||||
dest: '{{ remote_tmp_dir }}/{{ item }}'
|
dest: '{{ remote_tmp_dir }}/{{ item }}'
|
||||||
|
@ -27,21 +32,21 @@
|
||||||
- smtpserver.crt
|
- smtpserver.crt
|
||||||
- smtpserver.key
|
- smtpserver.key
|
||||||
|
|
||||||
# FIXME: Verify the mail after it was send would be nice
|
# FIXME: Verify the mail after it was send would be nice
|
||||||
# This would require either dumping the content, or registering async task output
|
# This would require either dumping the content, or registering async task output
|
||||||
- name: Start test smtpserver
|
- name: Start test smtpserver
|
||||||
shell: '{{ ansible_python.executable }} {{ remote_tmp_dir }}/smtpserver.py 10025:10465'
|
shell: '{{ ansible_python.executable }} {{ remote_tmp_dir }}/smtpserver.py 10025:10465'
|
||||||
async: 45
|
async: 45
|
||||||
poll: 0
|
poll: 0
|
||||||
register: smtpserver
|
register: smtpserver
|
||||||
|
|
||||||
- name: Send a basic test-mail
|
- name: Send a basic test-mail
|
||||||
mail:
|
mail:
|
||||||
port: 10025
|
port: 10025
|
||||||
subject: Test mail 1 (smtp)
|
subject: Test mail 1 (smtp)
|
||||||
secure: never
|
secure: never
|
||||||
|
|
||||||
- name: Send a test-mail with body and specific recipient
|
- name: Send a test-mail with body and specific recipient
|
||||||
mail:
|
mail:
|
||||||
port: 10025
|
port: 10025
|
||||||
from: ansible@localhost
|
from: ansible@localhost
|
||||||
|
@ -50,7 +55,7 @@
|
||||||
body: Test body 2
|
body: Test body 2
|
||||||
secure: never
|
secure: never
|
||||||
|
|
||||||
- name: Send a test-mail with attachment
|
- name: Send a test-mail with attachment
|
||||||
mail:
|
mail:
|
||||||
port: 10025
|
port: 10025
|
||||||
from: ansible@localhost
|
from: ansible@localhost
|
||||||
|
@ -60,8 +65,8 @@
|
||||||
attach: /etc/group
|
attach: /etc/group
|
||||||
secure: never
|
secure: never
|
||||||
|
|
||||||
# NOTE: This might fail if smtpd-tls is missing or python 2.7.8 or older is used
|
# NOTE: This might fail if smtpd-tls is missing or python 2.7.8 or older is used
|
||||||
- name: Send a test-mail using starttls
|
- name: Send a test-mail using starttls
|
||||||
mail:
|
mail:
|
||||||
port: 10025
|
port: 10025
|
||||||
from: ansible@localhost
|
from: ansible@localhost
|
||||||
|
@ -73,8 +78,8 @@
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: starttls_support
|
register: starttls_support
|
||||||
|
|
||||||
# NOTE: This might fail if smtpd-tls is missing or python 2.7.8 or older is used
|
# NOTE: This might fail if smtpd-tls is missing or python 2.7.8 or older is used
|
||||||
- name: Send a test-mail using TLS
|
- name: Send a test-mail using TLS
|
||||||
mail:
|
mail:
|
||||||
port: 10465
|
port: 10465
|
||||||
from: ansible@localhost
|
from: ansible@localhost
|
||||||
|
@ -86,15 +91,15 @@
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: tls_support
|
register: tls_support
|
||||||
|
|
||||||
- fail:
|
- fail:
|
||||||
msg: Sending mail using starttls failed.
|
msg: Sending mail using starttls failed.
|
||||||
when: smtpd_tls is succeeded and starttls_support is failed and tls_support is succeeded
|
when: smtpd_tls is succeeded and starttls_support is failed and tls_support is succeeded
|
||||||
|
|
||||||
- fail:
|
- fail:
|
||||||
msg: Send mail using TLS failed.
|
msg: Send mail using TLS failed.
|
||||||
when: smtpd_tls is succeeded and tls_support is failed and starttls_support is succeeded
|
when: smtpd_tls is succeeded and tls_support is failed and starttls_support is succeeded
|
||||||
|
|
||||||
- name: Send a test-mail with body, specific recipient and specific ehlohost
|
- name: Send a test-mail with body, specific recipient and specific ehlohost
|
||||||
mail:
|
mail:
|
||||||
port: 10025
|
port: 10025
|
||||||
ehlohost: some.domain.tld
|
ehlohost: some.domain.tld
|
||||||
|
|
Loading…
Reference in a new issue