Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11700468
D3659.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
D3659.diff
View Options
diff --git a/_tests/pillar/core/test_users.py b/_tests/pillar/core/test_users.py
--- a/_tests/pillar/core/test_users.py
+++ b/_tests/pillar/core/test_users.py
@@ -6,8 +6,33 @@
PILLAR_FILE = "../pillar/core/users.sls"
-USER_PROPERTIES_MANDATORY = set(["fullname", "ssh_keys", "uid"])
-USER_PROPERTIES_OPTIONAL = set(["class", "shell", "yubico_keys", "devserver_tasks"])
+USER_PROPERTIES_MANDATORY = set(
+ [
+ "fullname",
+ "uid",
+ ]
+)
+USER_PROPERTIES_OPTIONAL = set(
+ [
+ "class",
+ "devserver_tasks",
+ "everywhere_tasks",
+ "shell",
+ "yubico_keys",
+ ]
+)
+
+USER_PROPERTIES_AT_LEAST_ONE_OF_MANDATORY = [
+ set(
+ [
+ "ssh_keys",
+ "ssh_keys_by_forest",
+ ]
+ ),
+]
+
+for keys in USER_PROPERTIES_AT_LEAST_ONE_OF_MANDATORY:
+ USER_PROPERTIES_OPTIONAL.update(keys)
class Testinstance(unittest.TestCase):
@@ -33,6 +58,19 @@
errors.append(f" Invalid properties for {user}: {invalid_properties}")
is_valid = False
+ for keys_group in USER_PROPERTIES_AT_LEAST_ONE_OF_MANDATORY:
+ key_found = False
+ for key in keys_group:
+ if key in properties:
+ key_found = True
+ break
+
+ if not key_found:
+ errors.append(
+ f" Missing properties for {user}: at least one of {keys_group}"
+ )
+ is_valid = False
+
self.assertTrue(is_valid, "\n" + "\n".join(errors))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Sep 13, 14:02 (17 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2980972
Default Alt Text
D3659.diff (1 KB)
Attached To
Mode
D3659: Handle ssh_keys_by_forest and everywhere_tasks in pillar users test
Attached
Detach File
Event Timeline
Log In to Comment