systemd try to handle missing sessions#75097
Conversation
hopefully mitigates ansible#72674
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Tadej Borovšak <70951+tadeboro@users.noreply.github.com>
samdoran
left a comment
There was a problem hiding this comment.
This probably needs to be an explicit module parameter (or maybe a loginctl module?) allowing linger to be explicitly disabled/enabled for a specific user. And the argument spec needs to account for this option only making sense when scope=user. This probably also means we need a user parameter as well.
Right now we are inferring/guessing the user based on the effective UID or the login user account. I can see that not always being correct, say if someone is trying to configure a user unit for a user account other than the one being used by Ansible to manage the system.
| from ansible.module_utils.facts.system.chroot import is_chroot | ||
| from ansible.module_utils.service import sysv_exists, sysv_is_enabled, fail_if_missing | ||
| from ansible.module_utils._text import to_native | ||
| from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text |
There was a problem hiding this comment.
Minor nit: this import should be on line 276 so it's alphabetical.
| module.fail_json(msg="Service is in unknown state", status=result['status']) | ||
|
|
||
| if lingered: | ||
| disable_linger(module) |
There was a problem hiding this comment.
Disabling linger here will most likely result in the user unit not working as intended. In order for user units to start on boot and/or not be killed when a login session for the user account no longer exists, the user account must have linger permanently enabled.
| ''' allows for lingering dbus sessions ''' | ||
|
|
||
| enabled = False | ||
| user = getpass.getuser() |
There was a problem hiding this comment.
This may not always be the correct user account and may differ from the value in XDG_RUNTIME_DIR.
Co-authored-by: Sam Doran <sdoran@redhat.com>
Co-authored-by: Sam Doran <sdoran@redhat.com>
Co-authored-by: Sam Doran <sdoran@redhat.com>
hopefully mitigates #72674
ISSUE TYPE
COMPONENT NAME
systemd