Page MenuHomeDevCentral

D2803.diff
No OneTemporary

D2803.diff

diff --git a/_modules/forest.py b/_modules/forest.py
--- a/_modules/forest.py
+++ b/_modules/forest.py
@@ -88,6 +88,20 @@
return list(set(users))
+def _get_user(forest, username):
+ user = __pillar__["shellusers"][username]
+
+ if "ssh_keys" not in user:
+ user["ssh_keys"] = []
+
+ try:
+ user["ssh_keys"].extend(user["ssh_keys_by_forest"][forest])
+ except KeyError:
+ pass
+
+ return user
+
+
def get_users(forest=None):
"""
A function to get users for a forest as a dictionary,
@@ -99,7 +113,10 @@
"""
users = {}
+ if forest is None:
+ forest = get()
+
for username in list_users(forest):
- users[username] = __pillar__["shellusers"][username]
+ users[username] = _get_user(forest, username)
return users
diff --git a/roles/core/users/init.sls b/roles/core/users/init.sls
--- a/roles/core/users/init.sls
+++ b/roles/core/users/init.sls
@@ -131,7 +131,6 @@
- mode: 600
- template: jinja
- context:
- keys: {{ user['ssh_keys']|default([]) }}
- keys_forest: {{ user['ssh_key_by_forests'][forest]|default([]) }}
+ keys: {{ user['ssh_keys'] }}
{% endfor %}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 06:56 (20 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2264177
Default Alt Text
D2803.diff (1 KB)

Event Timeline