
    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	S
S/\SS/S.r\\S'   \R$                  " \5      rS rS\4S jrS\S\	S\S\SS4
S jrS\	S\4S jrg)z5Grub Dpkg: Configure grub debconf installation device    N)subputil)Cloud)Config)
MetaSchema)PER_INSTANCE)ProcessExecutionErrorcc_grub_dpkgubuntudebian	grub_dpkg	grub-dpkg)iddistros	frequencyactivate_by_schema_keysmetac                  <   Sn / nSnSn[        5       (       a  SnSn [        R                  " SSX#/SS	9R                  R                  5       n U (       a$  [        R                  R!                  U 5      (       d  g [        R                  " SSSSU /SS	9R                  R                  5       R#                  5       n[        R                  SSR%                  U5      5        U Vs/ s H  nSU;   d  M  UPM     nn[        R                  SSR%                  U5      5        U(       a  ['        U5      S   OU n[        R                  SU5        U$ ! [         ak  n[        UR                  [        5      (       a  [        R                  S
5         SnAGNDSUR                  ;   a  [        R                  S5         SnAGNoe SnAf[         a    [        R                  " [        S5         GNf = f! [         a     [        R                  " [        SU 5         GN[f = fs  snf )zv
Fetches the /dev/disk/by-id device grub is installed to.
Falls back to plain disk name if no by-id entry is present.
 diskz/bootdevicez	/boot/efiz
grub-probez-tT)capturez'grub-probe' not found in $PATHzfailed to get canonical pathz)grub-probe 'failed to get canonical path'Nz*grub-probe failed to execute for grub_dpkgudevadminfoz--rootz--query=symlinkz3udevadm DEVLINKS symlink query failed for disk='%s'z%considering these device symlinks: %s,z
disk/by-idz)filtered to these disk/by-id symlinks: %sr   zselected %s)is_efi_bootedr   stdoutstripr	   
isinstancereasonFileNotFoundErrorLOGdebugstderr	Exceptionr   logexcospathexistssplitjoinsorted)r   devicesprobe_targetprobe_mountedevidevss          ?/usr/lib/python3/dist-packages/cloudinit/config/cc_grub_dpkg.pyfetch_idevsr4      s   
 DG LK!Gyy4;T

& 	( rww~~d++
 IIFH.?F VEEGUW 	 II5sxx7HI%=gs)<sgG=II9388G;LM")F7OAtEIImU#LY !  ahh 122II788
 ,qxx7IIABB  GCEFG"  
F	

 >sH   0E :A G, #
H1H
G)4F=%F=<F==(G)(G),&HHreturnc                       [         R                  R                  S5      $ ! [         a   n [        R                  SU 5         Sn A gSn A ff = f)z,
Check if the system is booted in EFI mode.
z/sys/firmware/efiz7Failed to determine if system is booted in EFI mode: %sNF)r'   r(   r)   OSErrorr"   error)r0   s    r3   r   r   c   s=    ww~~122 		KQOs   ! 
AAAnamecfgcloudargsc                    UR                  SUR                  S0 5      5      nU(       d  0 nUR                  SS5      n[        R                  " U5      (       a  [        R	                  SX5        g [        U5      n[        R	                  SU5         [        R                  " S/US9  g ! [         a&  n[        R                  " [        S	U5         S nAg S nAff = f)
Nr   r   enabledFz*%s disabled by config grub_dpkg/enabled=%sz-Setting grub debconf-set-selections with '%s'zdebconf-set-selections)dataz6Failed to run debconf-set-selections for grub_dpkg: %s)	getr   is_falser"   r#   get_debconf_configr   r%   r&   )r9   r:   r;   r<   mycfgr>   	dconf_selr0   s           r3   handlerE   o   s    GGKb!9:Eii	5)G}}W		>N"5)III=yI
		+,9= 
I1	
 	

s   B) )
C3CCrC   c                    [        5       (       a*  [        R                  " U SS5      nUc
  [        5       nSU-  $ [        R                  " U SS5      nUc
  [        5       nU R	                  S5      nUc  U(       + nO+[        U[        5      (       d  [        R                  " U5      n[        U5      R                  5       nSU< SU< S3$ )	zX
Returns the debconf config for grub-pc or
grub-efi depending on the systems boot mode.
zgrub-efi/install_devicesNz+grub-pc grub-efi/install_devices string %s
zgrub-pc/install_deviceszgrub-pc/install_devices_emptyz'grub-pc grub-pc/install_devices string z/
grub-pc grub-pc/install_devices_empty boolean 
)
r   r   get_cfg_option_strr4   r@   r   booltranslate_boolstrlower)rC   r2   idevs_emptys      r3   rB   rB      s    
 ''-t
 =ME=EE''/H$O=MEii ?@#)KK..--k:K+&,,. k#	
    )__doc__loggingr'   	cloudinitr   r   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   cloudinit.settingsr   cloudinit.subpr	   r   __annotations__	getLogger__name__r"   r4   rI   r   rK   listrE   rB    rN   r3   <module>r\      s    <  	   ! # . + 0 (# +[9	j  !AH	t 	
 
6 
% 
t 
 
* 
f  
  
rN   