Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current provider uses two steps in the self.instances routine:
loginctl list-users. Result is a list of all users with an open session (so this includes user which are lingering, users that are logged in etc.).loginctl show-useris executed to get the current state of the 'Linger' setting.The second command also fails for users not logged in. Since the first command only lists logged in users, the falure is a quite seldom event (also described in #302 ).
A user with disabled linger is 'usally' (at least im not logged in on all machines running puppet ;)) not logged in, so it does not apear on the first command. Therefore it's linger status is not checked. This results in running loginctl to disable the setting on each puppet run (described in #301 ).
The approach I took in this MR is to get the Linger status in a single step and handle the failure in case the user is not logged in. If the user is logged in, we an use the Linger state to decide if lingering is activated or not. In the case the user is not logged in, it's for shure not lingering (since these are listed). So setting the is value to disabled should be correct.
Fixes: #302
Fixes: #301