@@ -171,7 +171,7 @@ async def ktadd(
171171
172172 :param list[str] names: principals
173173 :param str fn: filename
174- :param bool is_rand_key: generate random key
174+ :param bool is_rand_key: generate new principal keys
175175 """
176176
177177 @abstractmethod
@@ -335,31 +335,26 @@ async def ktadd(
335335 self ,
336336 names : list [str ],
337337 fn : str ,
338- is_rand_key : bool = False ,
338+ is_rand_key : bool = True ,
339339 ) -> None :
340340 """Create or write to keytab.
341341
342342 :param list[str] names: principals
343343 :param str fn: filename
344- :param bool is_rand_key: generate random key
344+ :param bool is_rand_key: generate new principal keys
345345 :raises PrincipalNotFoundError: on not found princ
346346 """
347347 principals = [await self ._get_raw_principal (name ) for name in names ]
348348 if not all (principals ):
349349 raise PrincipalNotFoundError ("Principal not found" )
350350
351- if is_rand_key :
352- for princ in principals :
353- await self .loop .run_in_executor (
354- self .pool ,
355- princ .ktadd ,
356- fn ,
357- True ,
358- )
359-
360- else :
361- for princ in principals :
362- await self .loop .run_in_executor (self .pool , princ .ktadd , fn )
351+ for princ in principals :
352+ await self .loop .run_in_executor (
353+ self .pool ,
354+ princ .ktadd ,
355+ fn ,
356+ is_rand_key ,
357+ )
363358
364359 async def lock_princ (self , name : str , ** dbargs ) -> None :
365360 """Lock princ.
@@ -678,17 +673,12 @@ async def ktadd(
678673 :param KtaddRequest request: request data
679674 """
680675 filename = os .path .join (gettempdir (), str (uuid .uuid1 ()))
681- if request .is_rand_key :
682- await kadmin .ktadd (
683- request .names ,
684- filename ,
685- is_rand_key = request .is_rand_key ,
686- )
687- else :
688- await kadmin .ktadd (
689- request .names ,
690- filename ,
691- )
676+ await kadmin .ktadd (
677+ request .names ,
678+ filename ,
679+ request .is_rand_key ,
680+ )
681+
692682 return FileResponse (
693683 filename ,
694684 background = BackgroundTask (os .unlink , filename ),
0 commit comments