Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systemd 256 loginctl changes #20400

Merged
merged 2 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,9 @@ def _terminate_sessions(self) -> None:
raise

# terminate all systemd user services for users who are not logged in
m.execute("systemctl stop user@*.service")
# since systemd 256 we stop user@*.service now also stops the root session (uid 0)
m.execute("cd /run/systemd/users/; "
"for f in $(ls); do [ $f -le 500 ] || systemctl stop user@$f; done")

# Clean up "closing" sessions again, and clean user id cache for non-system users
m.execute("systemctl stop systemd-logind; cd /run/systemd/users/; "
Expand Down
3 changes: 2 additions & 1 deletion test/verify/check-session
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class TestSession(testlib.MachineCase):

# Check session type
if not m.ostree_image:
session_id = m.execute("loginctl list-sessions | awk '/admin/ {print $1}'").strip()
# Systemd 256 also shows a class=manager session for admin
session_id = m.execute("loginctl list-sessions | grep -v manager | awk '/admin/ {print $1}'").strip()
self.assertEqual(m.execute(f"loginctl show-session -p Type {session_id}").strip(), "Type=web")

# Logout
Expand Down
3 changes: 3 additions & 0 deletions test/verify/check-static-login
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,9 @@ matchrule = <SUBJECT>^DC=LAN,DC=COCKPIT,CN=alice$
self.assertGreaterEqual(len(sessions), 1)
for session in sessions:
out = m.execute('loginctl session-status ' + session)
# Skip manager session
if "Class: manager" in out:
continue
if "State: active" in out: # skip closing sessions
self.assertIn(session_leader, out)
self.assertIn('cockpit-bridge', out)
Expand Down