Skip to content

Commit f9311c6

Browse files
osfricklerpriteau
authored andcommitted
Fix failure in deployment with missing group
The backported prometheus-libvirt-exporter feature missed a safety guard to avoid failing when deployments haven't updated their environment with the new group used by that feature. Deployers will still be warned to add the group when they run the inventory precheck, but deployments won't be failing if they ignore it. Change-Id: I1dc5baa8d0da2a454eaa4459e87fc22a275698df Signed-off-by: Dr. Jens Harbott <[email protected]> (cherry picked from commit dfdbddf)
1 parent 112edb8 commit f9311c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ansible/roles/prometheus/tasks/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
group: "{{ config_owner_group }}"
99
mode: "0770"
1010
when:
11-
- inventory_hostname in groups[item.value.group]
11+
- inventory_hostname in groups.get(item.value.group, [])
1212
- item.value.enabled | bool
1313
with_dict: "{{ prometheus_services }}"
1414

@@ -23,7 +23,7 @@
2323
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
2424
mode: "0660"
2525
when:
26-
- inventory_hostname in groups[item.value.group]
26+
- inventory_hostname in groups.get(item.value.group, [])
2727
- item.value.enabled | bool
2828
with_dict: "{{ prometheus_services }}"
2929
notify:
@@ -48,7 +48,7 @@
4848
dest: "{{ node_config_directory }}/prometheus-server/{{ item.path | basename }}"
4949
mode: "0660"
5050
when:
51-
- inventory_hostname in groups[service.group]
51+
- inventory_hostname in groups.get(item.value.group, [])
5252
- service.enabled | bool and enable_prometheus_alertmanager | bool
5353
- prometheus_alert_rules is defined and prometheus_alert_rules.files | length > 0
5454
with_items: "{{ prometheus_alert_rules.files }}"

0 commit comments

Comments
 (0)