refactor: improve get_service_name suffix handling and handler usage

- Updated filter_plugins/get_service_name.py:
  * Default suffix handling: auto-select .service (no '@') or .timer (with '@')
  * Explicit False disables suffix entirely
  * Explicit string suffix still supported
- Updated sys-systemctl handler to use new filter instead of SYS_SERVICE_SUFFIX
- Extended unit tests to cover new suffix behavior

Ref: https://chat.openai.com/share/8c2de9e6-daa0-44dd-ae13-d7a7d8d8b6d9
This commit is contained in:
2025-08-18 22:36:31 +02:00
parent bf63e01b98
commit b9461026a6
3 changed files with 39 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
- name: "refresh systemctl service"
systemd:
name: "{{ systemctl_id }}{{ SYS_SERVICE_SUFFIX }}"
name: "{{ systemctl_id | get_service_name(SOFTWARE_NAME) }}"
daemon_reload: yes
enabled: yes
state: "{{ systemctl_state }}"