Add support for metadata
enable defining known_hosts via metadata in other formulas
Related: PROD-25696
Change-Id: I821d51675700719d665259a4ed24a30667b7fd0c
diff --git a/openssh/client/known_host.sls b/openssh/client/known_host.sls
index 664e138..edc6746 100644
--- a/openssh/client/known_host.sls
+++ b/openssh/client/known_host.sls
@@ -4,7 +4,18 @@
include:
- openssh.client.service
-{%- for xxx, user in client.get('user', {}).iteritems() %}
+{%- set _users = client.get('user', {}) %}
+{%- for service_name, service in pillar.items() %}
+ {%- set support_fragment_file = service_name+'/meta/openssh.yml' %}
+ {%- macro load_support_file() %}{% include support_fragment_file ignore missing %}{% endmacro %}
+ {%- set support_yaml = load_support_file()|load_yaml %}
+
+ {%- if support_yaml and support_yaml.get('user', {}) %}
+ {%- do _users.update(support_yaml.get('user', {})) %}
+ {%- endif %}
+{%- endfor %}
+
+{%- for xxx, user in _users.iteritems() %}
{%- if user.get('purge_undefined', False) %}
{{ user.user.name }}_remove_old_known_hosts_file: