Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3778987
D2803.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D2803.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D2803: Resolve in forest module user SSH keys
Attached
Detach File
Event Timeline
Log In to Comment