Mac: hermes settings, detect unset keys from stderr

`hermes config get` writes "Config key not set" to stderr and Hermes's
default to stdout, so terminal.cwd: null looked set ("."), the play tried
to unset it again and `unset` failed on the missing key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-11 07:24:47 -07:00
1 parent 4592ee2132
commit 3f4ed3efcb
1 file changed
+3 -2
+3 -2
View File
@@ -1,4 +1,4 @@
# `hermes config get` prints the value as YAML (or "Config key not set"), so # `hermes config get` prints the value as YAML, so
# it's compared structurally; `hermes config set` takes JSON for lists and # it's compared structurally; `hermes config set` takes JSON for lists and
# booleans. A null value means the key should not be set at all. # booleans. A null value means the key should not be set at all.
- name: Read Hermes settings - name: Read Hermes settings
@@ -18,8 +18,9 @@
loop: "{{ hermes_settings_current.results }}" loop: "{{ hermes_settings_current.results }}"
loop_control: loop_control:
label: "{{ item.item.key }} = {{ item.item.value | to_json }}" label: "{{ item.item.key }} = {{ item.item.value | to_json }}"
# "Config key not set" goes to stderr, with Hermes's default on stdout.
when: >- when: >-
(none if item.stdout is search('^Config key not set') else item.stdout | from_yaml) (none if item.stderr is search('Config key not set') else item.stdout | from_yaml)
!= item.item.value != item.item.value
# The dashboard is a separate process with its own copy of the settings. # The dashboard is a separate process with its own copy of the settings.
notify: [Restart Hermes gateway, Restart Hermes dashboard] notify: [Restart Hermes gateway, Restart Hermes dashboard]