%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.9/site-packages/cloudinit/config/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.9/site-packages/cloudinit/config/__pycache__/cc_grub_dpkg.cpython-39.pyc

a

'�Dg��@s�UdZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZd	d
dge
dd
gd�Zeed<e�e�Zdd�Zed�dd�Zee	eedd�dd�Ze	ed�dd�ZdS)z5Grub Dpkg: Configure grub debconf installation device�N)�subp�util)�Cloud)�Config)�
MetaSchema)�PER_INSTANCE)�ProcessExecutionErrorZcc_grub_dpkgZubuntuZdebian�	grub_dpkg�	grub-dpkg)�idZdistrosZ	frequencyZactivate_by_schema_keys�metac
Csfd}g}d}d}t�rd}d}z tjdd||gdd	�j��}Wnpty�}z<t|jt�rft�	d
�nd|j
vr|t�	d�n�WYd
}~n&d
}~0ty�t�
td�Yn0|r�tj�|�s�dSz&tjdddd|gdd	�j����}Wn"t�yt�
td|�Yn0t�	dd�|��dd�|D�}t�	dd�|��|�rRt|�dn|}t�	d|�|S)z�
    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/bootZdevicez	/boot/efiz
grub-probez-tT)Zcapturez'grub-probe' not found in $PATHzfailed to get canonical pathz)grub-probe 'failed to get canonical path'Nz*grub-probe failed to execute for grub_dpkgZudevadm�infoz--rootz--query=symlinkz3udevadm DEVLINKS symlink query failed for disk='%s'z%considering these device symlinks: %s�,cSsg|]}d|vr|�qS)z
disk/by-id�)�.0�devrr�A/usr/lib/python3.9/site-packages/cloudinit/config/cc_grub_dpkg.py�
<listcomp>Z�zfetch_idevs.<locals>.<listcomp>z)filtered to these disk/by-id symlinks: %srzselected %s)�
is_efi_bootedr�stdout�stripr�
isinstance�reason�FileNotFoundError�LOG�debug�stderr�	Exceptionr�logexc�os�path�exists�split�join�sorted)rZdevicesZprobe_targetZprobe_mount�e�idevsrrr�fetch_idevssJ�
���
r*)�returnc
CsFztj�d�WSty@}zt�d|�WYd}~dSd}~00dS)z4
    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)r(rrrrcs
r)�name�cfg�cloud�argsr+c
Cs�|�d|�di��}|si}|�dd�}t�|�rDt�d||�dSt|�}t�d|�ztjdg|d�Wn2ty�}zt�td	|�WYd}~n
d}~00dS)
Nr	r
�enabledFz*%s disabled by config grub_dpkg/enabled=%sz-Setting grub debconf-set-selections with '%s'zdebconf-set-selections)�dataz6Failed to run debconf-set-selections for grub_dpkg: %s)	�getrZis_falserr�get_debconf_configrr r!)r.r/r0r1�mycfgr2Z	dconf_selr(rrr�handleos
�r7)r6r+cCs�t�r*t�|dd�}|dur"t�}d|St�|dd�}|durFt�}|�d�}|dur`|}nt|t�stt�|�}t|��	�}d||fSdS)zd
    Returns the debconf config for grub-pc or
    grub-efi depending on the systems boot mode.
    zgrub-efi/install_devicesNz+grub-pc grub-efi/install_devices string %s
zgrub-pc/install_deviceszgrub-pc/install_devices_emptyz[grub-pc grub-pc/install_devices string %s
grub-pc grub-pc/install_devices_empty boolean %s
)
rrZget_cfg_option_strr*r4r�boolZtranslate_bool�str�lower)r6r)Zidevs_emptyrrrr5�s(�


��r5)�__doc__Zloggingr"Z	cloudinitrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarZcloudinit.settingsrZcloudinit.subprr�__annotations__Z	getLogger�__name__rr*r8rr9�listr7r5rrrr�<module>	s$�
D

Zerion Mini Shell 1.0