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

update_agent: handle new output format for loginctl #1059

Merged
merged 1 commit into from
Aug 15, 2023

Conversation

dustymabe
Copy link
Member

In systemd 254 the loginctl list-sessions --json output was modified slightly:

Before

[{"session":"4","uid":1000,"user":"core","seat":"","tty":""}]

After

[{"session":"17","uid":1000,"user":"core","seat":"","tty":"n/a","state":"active","idle":false,"since":null}]

Notice the change from "" to "n/a" for the tty field.

This change probably happened in one of:

Let's update the code to handle the new case.

Fixes coreos/fedora-coreos-tracker#1547

Copy link
Contributor

@prestist prestist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! great job.

src/update_agent/mod.rs Outdated Show resolved Hide resolved
src/update_agent/mod.rs Outdated Show resolved Hide resolved
src/update_agent/mod.rs Outdated Show resolved Hide resolved
@dustymabe dustymabe force-pushed the dusty-fix-loginctl branch 2 times, most recently from 6db7656 to 497b06f Compare August 15, 2023 17:53
In systemd 254 the `loginctl list-sessions --json` output was modified slightly:

Before
```
[{"session":"4","uid":1000,"user":"core","seat":"","tty":""}]
```

After
```
[{"session":"17","uid":1000,"user":"core","seat":"","tty":"n/a","state":"active","idle":false,"since":null}]
```

Notice the change from `""` to `"n/a"` for the `tty` field.

This change probably happened in one of:

- systemd/systemd#27769
- systemd/systemd#27740
- systemd/systemd#27606

Let's update the code to handle the new case and rename the function to
be a little more appropriate since the use case for it is narrow.

Fixes coreos/fedora-coreos-tracker#1547
@cgwalters cgwalters merged commit a62dd13 into coreos:main Aug 15, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

systemd 254+ loginctl json output change breaks zincati session detection
3 participants