Skip to content

Commit

Permalink
Fix crash when loginctl produces no output to stdout.
Browse files Browse the repository at this point in the history
  • Loading branch information
gizmoguy committed Oct 3, 2022
1 parent 635ca91 commit 339d6e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion handlers/restart-dm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- name: Get active loginctl session details
ansible.builtin.command:
cmd: "loginctl show-session {{ item.session }} --property=Class --property=Type"
loop: "{{ _loginctl_sessions.stdout | from_json }}"
loop: "{{ _loginctl_sessions.stdout | default('[]', true) | from_json }}"
loop_control:
label: "session {{ item.session }} for user {{ item.user }}"
register: _loginctl_session_details
Expand All @@ -25,6 +25,7 @@
].item.session'
)
}}"
when: "_loginctl_session_details"
listen: restart display manager

- name: Restart display manager service
Expand Down

0 comments on commit 339d6e2

Please sign in to comment.