diff --git a/seed/forgejo/dictionaries/31_forgejo.xml b/seed/forgejo/dictionaries/31_forgejo.xml
index cf0b061a..2b239ea6 100644
--- a/seed/forgejo/dictionaries/31_forgejo.xml
+++ b/seed/forgejo/dictionaries/31_forgejo.xml
@@ -67,6 +67,11 @@
+
+
+ forgejo
+
+
diff --git a/seed/forgejo/templates/forgejo.yml b/seed/forgejo/templates/forgejo.yml
index c10b0c95..37af6336 100644
--- a/seed/forgejo/templates/forgejo.yml
+++ b/seed/forgejo/templates/forgejo.yml
@@ -8,3 +8,4 @@ auth_server: %%oauth2_server_domainname
username: %%username
password: %%get_password(server_name='test', username=%%username, description='test', type="cleartext", hide=%%hide_secret, temporary=True)
forgejo_title: "%%forgejo_title"
+git_url: "[%%domain]:2222"
diff --git a/seed/forgejo/tests/test_forgejo.py b/seed/forgejo/tests/test_forgejo.py
index d42a957a..8dfac213 100644
--- a/seed/forgejo/tests/test_forgejo.py
+++ b/seed/forgejo/tests/test_forgejo.py
@@ -7,7 +7,7 @@ from shutil import move
from glob import glob
from tempfile import TemporaryDirectory
from subprocess import run
-from dulwich.porcelain import init, clone, add, commit, push
+from dulwich.porcelain import init, clone, add, commit, push, pull
from revprox import Authentication
@@ -15,13 +15,14 @@ from mookdns import MookDnsSystem
PORT = '3000'
-FORGEJO_USERNAME = 'forgejo'
+FORGEJO_USERNAME = 'git'
FORGEJO_PORT = '2222'
KEY_FILE = '/var/lib/risotto/srv/hosts/forgejo'
# transition between gitea and forgejo
GITEA_KEY_FILE = '/var/lib/risotto/srv/hosts/gitea'
CONFIG_SSH = expandvars('$HOME/.ssh/config')
CONFIG_GIT = expandvars('$HOME/.gitconfig')
+CONFIG_KNOWN_HOST = expandvars('$HOME/.ssh/known_hosts')
AUTHENTICATION = None
@@ -193,6 +194,8 @@ def test_repo():
if 'FIRST_RUN' in environ:
# delete_ssh_key(authentication, data)
add_ssh_key(authentication, data)
+ cmd = ['/usr/bin/ssh-keygen', '-f', CONFIG_KNOWN_HOST, '-R', data['git_url']]
+ run(cmd)
if not isfile(KEY_FILE):
if isfile(GITEA_KEY_FILE):
move(GITEA_KEY_FILE, KEY_FILE)
@@ -292,6 +295,8 @@ def test_repo_persistent():
# add a new line in file and commit
with open(filename, 'a') as fh:
fh.write('\ntest')
+ with open(filename, 'r') as fh:
+ len_line = len(fh.read().split('\n'))
add(repo, filename)
date = datetime.datetime.now()
commit_message = f'test commit {date}'.encode()
@@ -301,7 +306,12 @@ def test_repo_persistent():
refspecs='master',
)
# test if commit is added and last commit
+ pull(repo=repo,
+ remote_location=ssh_url,
+ refspecs='master',
+ )
lst = list(repo.get_walker())
len_after_commit = len(lst)
+ assert len_after_commit == len_line
assert len_before_commit + 1 == len_after_commit
- assert lst[-1].commit.message == commit_message
+ assert lst[0].commit.message == commit_message
diff --git a/seed/host-systemd-machined/dictionaries/21-machined.xml b/seed/host-systemd-machined/dictionaries/21-machined.xml
index ef01c48c..f97bf5d6 100644
--- a/seed/host-systemd-machined/dictionaries/21-machined.xml
+++ b/seed/host-systemd-machined/dictionaries/21-machined.xml
@@ -13,7 +13,7 @@
- /usr/local/lib/risotto-tmpfiles.d/0asystemd-nspawn.conf
+ /tmpfiles.d/0asystemd-nspawn.conf
/etc/systemd/system/systemd-nspawn@.service.d/systemd-nspawn@.conf
/etc/distro.repos.d/boot.repo
/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-35-x86_64
@@ -58,6 +58,7 @@
python3-dulwich
python3-psycopg2
python3-redis
+ python3-imaplib2
diff --git a/seed/host-systemd-machined/extras/machined/00-machined.xml b/seed/host-systemd-machined/extras/machined/00-machined.xml
index 48acc182..cb705dbe 100644
--- a/seed/host-systemd-machined/extras/machined/00-machined.xml
+++ b/seed/host-systemd-machined/extras/machined/00-machined.xml
@@ -22,7 +22,7 @@
- /usr/local/lib/sbin/network-
+ /sbin/network-
machined.machines
True
diff --git a/seed/host-systemd-machined/templates/0asystemd-nspawn.conf b/seed/host-systemd-machined/templates/0asystemd-nspawn.conf
index 0d222a44..8dcb7785 100644
--- a/seed/host-systemd-machined/templates/0asystemd-nspawn.conf
+++ b/seed/host-systemd-machined/templates/0asystemd-nspawn.conf
@@ -1,7 +1,5 @@
-D /usr/local/lib/sbin/ 0755 root root - -
D /etc/systemd/nspawn/ 0755 root root - -
D /etc/systemd/network/ 0755 root root - -
-D /usr/local/lib/systemd/system/ 0755 root root - -
D /etc/systemd/system/machines.target.wants/ 0755 root root - -
d /var/lib/risotto/configurations/ 0755 root root - -
r /etc/network/interfaces - - - - -
diff --git a/seed/postfix-relay/tests/test_smtp.py b/seed/postfix-relay/tests/test_smtp.py
index d5638ff0..2e28f300 100644
--- a/seed/postfix-relay/tests/test_smtp.py
+++ b/seed/postfix-relay/tests/test_smtp.py
@@ -1,5 +1,6 @@
from yaml import load, SafeLoader
from os import environ
+from os.path import isfile
import pytest
import datetime
@@ -7,18 +8,22 @@ from imaplib2 import IMAP4_SSL
from smtplib import SMTP, SMTPNotSupportedError, SMTPAuthenticationError
-
conf_file = f'{environ["MACHINE_TEST_DIR"]}/imap.yml'
-with open(conf_file) as yaml:
- data = load(yaml, Loader=SafeLoader)
-parameters = (
- (1, 5, 'user', data['username'], data['username'], data['username'], [data['password']]),
- (2, 5, 'user', data['username'], data['username'], 'alias_' + data['username'], [data['password']]),
- (1, 3, 'family', data['username_family'], data['username_family'], data['username_family'], [data['password_family'], data['password_family'] + "2"]),
- (3, 5, 'user', data['username'], data['ext_username'], data['username'], [data['password']]),
- (4, 5, 'user', data['username'], data['ext_username'], 'alias_' + data['username'], [data['password']]),
- (2, 3, 'family', data['username_family'], data['ext_username'], data['username_family'], [data['password_family'], data['password_family'] + "2"]),
- )
+if not isfile(conf_file):
+ print('no IMAP server, so desactived')
+ parameters = ()
+else:
+ NO_DATA=False
+ with open(conf_file) as yaml:
+ data = load(yaml, Loader=SafeLoader)
+ parameters = (
+ (1, 5, 'user', data['username'], data['username'], data['username'], [data['password']]),
+ (2, 5, 'user', data['username'], data['username'], 'alias_' + data['username'], [data['password']]),
+ (1, 3, 'family', data['username_family'], data['username_family'], data['username_family'], [data['password_family'], data['password_family'] + "2"]),
+ (3, 5, 'user', data['username'], data['ext_username'], data['username'], [data['password']]),
+ (4, 5, 'user', data['username'], data['ext_username'], 'alias_' + data['username'], [data['password']]),
+ (2, 3, 'family', data['username_family'], data['ext_username'], data['username_family'], [data['password_family'], data['password_family'] + "2"]),
+ )
def get_msg(username, dest, msg='MESSAGE', with_date=True):