python3 fix modules "unorderable types: dict() < dict()"
---------- │·
ID: /etc/prometheus/prometheus.yml │·
Function: file.managed │·
Result: False │·
Comment: Unable to manage file: Jinja error: unorderable types: dict() < dict() │·
Traceback (most recent call last): │·
File "/usr/lib/python3/dist-packages/salt/utils/templates.py", line 392, in render_jinja_tmpl │·
output = template.render(**decoded_context) │·
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1008, in render │·
return self.environment.handle_exception(exc_info, True) │·
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 780, in handle_exception │·
reraise(exc_type, exc_value, tb) │·
File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 37, in reraise │·
raise value.with_traceback(tb) │·
File "<template>", line 53, in top-level template code │·
File "/var/cache/salt/minion/extmods/modules/prometheus.py", line 3, in prometheus_targets_for_grain │·
return [ remote_grains[key] for remote_grains in sorted(values) if key in remote_grains ] │·
TypeError: unorderable types: dict() < dict() │·
│·
; line 53 │·
│·
--- │·
[...] │·
- 'localhost:9100' │·
{%- for remote_grains in salt['mine.get']('*', 'grains.items', tgt_type='glob').values() if remote_grains.fqdn != grains.fqdn %} │·
- '{{ remote_grains.fqdn }}:9100' │·
{%- endfor %} │·
│·
{% set nginx_targets = salt['prometheus.prometheus_targets_for_grain']('prometheus_nginx_export') %} <====================== │·
- job_name: nginx │·
scheme: https │·
metrics_path: /_metrics │·
static_configs: │·
- targets: {{ nginx_targets|yaml }} │·
[...] │·
--- │·
Started: 19:18:06.413857 │·
Duration: 910.485 ms