@@ -93,6 +93,14 @@ def add_group_members(group_name: str, members: list[str]) -> None:
93
93
subprocess .check_call (cmd )
94
94
95
95
96
+ def _filter_opts (
97
+ options : typing .Optional [typing .Iterable [tuple [str , str ]]]
98
+ ) -> list [tuple [str , str ]]:
99
+ _skip_keys = ["netbios name" ]
100
+ options = options or []
101
+ return [(k , v ) for (k , v ) in options if k not in _skip_keys ]
102
+
103
+
96
104
def _provision_cmd (
97
105
realm : str ,
98
106
dcname : str ,
@@ -116,10 +124,9 @@ def _provision_cmd(
116
124
f"--domain={ domain } " ,
117
125
f"--adminpass={ admin_password } " ,
118
126
]
119
- for okey , oval in options or []:
120
- if okey == "netbios name" :
121
- continue
122
- cmd = cmd [f"--option={ okey } ={ oval } " ]
127
+ cmd = cmd [
128
+ [f"--option={ okey } ={ oval } " for okey , oval in _filter_opts (options )]
129
+ ]
123
130
return cmd .argv ()
124
131
125
132
@@ -145,10 +152,9 @@ def _join_cmd(
145
152
f"--dns-backend={ dns_backend } " ,
146
153
f"--password={ admin_password } " ,
147
154
]
148
- for okey , oval in options or []:
149
- if okey == "netbios name" :
150
- continue
151
- cmd = cmd [f"--option={ okey } ={ oval } " ]
155
+ cmd = cmd [
156
+ [f"--option={ okey } ={ oval } " for okey , oval in _filter_opts (options )]
157
+ ]
152
158
return cmd .argv ()
153
159
154
160
0 commit comments