Browse Source

iteritems -> items, handle none match

master
Sean Johnson 1 year ago
parent
commit
0e91c45ace
  1. 3
      _modules/nodemeta.py
  2. 2
      base/grains.sls

3
_modules/nodemeta.py

@ -57,6 +57,9 @@ def _grains_from_name(cfg): @@ -57,6 +57,9 @@ def _grains_from_name(cfg):
hostname = _get_hostname(cfg)
rematch = _regex.search(hostname)
if rematch is None:
log.warning(f"Could not parse grains from subject `{hostname}`")
return {}
return {
"app": rematch.group("app"),

2
base/grains.sls

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
{% set current_node = salt["nodemeta.current_node"]() or {} %}
{% for key, value in current_node.iteritems() %}
{% for key, value in current_node.items() %}
{{ key|yaml_dquote }}:
grains.present:
- value: {{ value|yaml_dquote }}

Loading…
Cancel
Save