
    x[h              
           % S r SSKrSSKrSSKJrJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  SSKJr  S	rS
/ SQ\/ S.r\\S'   \R&                  " \5      rS\S\	S\S\SS4
S jrS rS\S\S\4S jrg)zSSH Import ID: Import SSH id    N)subputil)Cloud)Config)
MetaSchema)ug_util)PER_INSTANCEzssh-import-idcc_ssh_import_id)alpinecosdebianubuntu)iddistros	frequencyactivate_by_schema_keysmetanamecfgcloudargsreturnc                    [        US5      (       d  [        R                  S5        g [        R                  " [
        5      (       d  [        R                  S5        g U(       a'  US   n/ n[        U5      S:  a  USS  n[        XT5        g [        R                  " XR                  5      u  pg/ nUR                  5        H  u  pI/ n
U	S   (       a  [        R                  " US/ 5      n
O U	S   n
 [        R                   " U
5      n
U
 Vs/ s H  n[#        U5      PM     n
n[        U
5      (       d  Mt   [        X5        M     [        U5      (       a  US   eg ! [         a    [        R                  SU5         M  f = fs  snf ! [         a    [        R                  SU5         M  f = f! [         a9  n[        R$                  " [        S	XJ5        UR'                  U5         S nAGM+  S nAff = f)
Nssh_import_idzISkipping module named ssh_import_id, no 'ssh_import_id' directives found.zXssh-import-id is not installed, but module ssh_import_id is configured. Skipping module.r      defaultz+User %s is not configured for ssh_import_idz5User %s is not correctly configured for ssh_import_idzssh-import-id failed for: %s %s)is_key_in_nested_dictLOGdebugr   whichSSH_IMPORT_ID_BINARYwarninglenimport_ssh_idsr   normalize_users_groupsdistroitemsr   get_cfg_option_list	Exception
uniq_mergestrlogexcappend)r   r   r   r   useridsusers_groupselistuser_cfg
import_idsiexcs                C/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_import_id.pyhandler8   "   s    o66		!	
 	ZZ,--+	
 	 Awt9q=qr(Cs! 55c<<HUE++-
I11#KJ%o6

	4J*45*Q#a&*J5 :	:,1 (> 5zzAh 1  		GN 6 	IIG 		  	KK6 LL		sN   *E0F
F F4F, E=<E= F F)(F),
G/6-G**G/c                 B   U(       a  U (       d  [         R                  SX5        g  [        R                  " U5        [
        R                  " S5      (       a  SSSU[        /U -   nO?[
        R                  " S5      (       a  SSU[        /U -   nO[         R                  S5        g [         R                  SU5         [
        R
                  " US	S
9  g ! [         a  nUeS nAff = f! [
        R                   a#  n[        R                  " [         SU5        UeS nAff = f)Nz(empty user(%s) or ids(%s). not importingsudoz--preserve-env=https_proxyz-Hudoasz-uz:Neither sudo nor doas available! Unable to import SSH ids.zImporting SSH ids for user %s.F)capturez*Failed to run command to import %s SSH ids)r   r   pwdgetpwnamKeyErrorr   r    r!   errorProcessExecutionErrorr   r,   )r/   r.   r6   cmds       r7   r$   r$   a   s   S		<dHT: zz&( 
  
F		 	

  			NOII.5		#u%c  	d %% CEtL	s/   C =C' 
C$CC$'D;DDconfig
search_keyc                 4   U R                  5        H  nX:X  a    g[        X   [        5      (       a  [        X   U5      (       a    g[        X   [        5      (       d  MO  X    H-  n[        U[        5      (       d  M  [        X15      (       d  M,      g   M     g)zSearch for key nested in config.

Note: A dict embedded in a list of lists will not be found walked - but in
this case we don't need it.
TF)keys
isinstancedictr   list)rC   rD   
config_keyitems       r7   r   r      s     kkm
#f($//$V%7DDf($// *dD)),T>># + $     )__doc__loggingr=   	cloudinitr   r   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   cloudinit.distrosr   cloudinit.settingsr	   r!   r   __annotations__	getLogger__name__r   r+   rI   r8   r$   rH   boolr    rL   r7   <module>rZ      s    #  
   ! # . % + '  4!	j  !< <6 <% <t < <~<~$ C D rL   