HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/cloudinit/config/__pycache__/cc_grub_dpkg.cpython-311.pyc
�

܍~c����UdZddlZddlmZddlmZddlmZmZddl	m
Z
ddlmZddl
mZmZdd	lmZdd
lmZdZdd
gZdddeeeed��ggd�Zeed<ee��Zd�Zdedede
dededdfd�ZdS)z5Grub Dpkg: Configure grub debconf installation device�N)�Logger)�dedent)�subp�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�PER_INSTANCE)�ProcessExecutionErrora�Configure which device is used as the target for grub installation. This module
can be enabled/disabled using the ``enabled`` config key in the ``grub_dpkg``
config dict. The global config key ``grub-dpkg`` is an alias for ``grub_dpkg``.
If no installation device is specified this module will execute grub-probe to
determine which disk the /boot directory is associated with.

The value which is placed into the debconf database is in the format which the
grub postinstall script expects. Normally, this is a /dev/disk/by-id/ value,
but we do fallback to the plain disk name if a by-id name is not present.

If this module is executed inside a container, then the debconf database is
seeded with empty values, and install_devices_empty is set to true.
�ubuntu�debian�cc_grub_dpkgz	Grub Dpkgz*Configure grub debconf installation devicez�            grub_dpkg:
              enabled: true
              grub-pc/install_devices: /dev/sda
              grub-pc/install_devices_empty: false
            )�id�name�title�description�distros�	frequency�examples�activate_by_schema_keys�metac��d}g}	tjgd�d���d���}n�#t$rZ}t|jt
��r|�d��n d|jvr|�d��n�Yd	}~n(d	}~wt$rtj
|d
��YnwxYw|rtj�
|��sdS	tjddd
d|gd���d������}n&#t$rtj
|d|��YnwxYw|�dd�|����d�|D��}|�dd�|����|rt!|��dn|}|�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.
    �)z
grub-probez-t�diskz/bootT)�capturerz'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-dpkg�udevadm�infoz--rootz--query=symlinkz3udevadm DEVLINKS symlink query failed for disk='%s'z%considering these device symlinks: %s�,c��g|]}d|v�|��	S)z
disk/by-id�)�.0�devs  �?/usr/lib/python3/dist-packages/cloudinit/config/cc_grub_dpkg.py�
<listcomp>zfetch_idevs.<locals>.<listcomp>os"��=�=�=�s���)<�)<�s�)<�)<�)<�z)filtered to these disk/by-id symlinks: %szselected %s)r�stripr�
isinstance�reason�FileNotFoundError�debug�stderr�	Exceptionr�logexc�os�path�exists�split�join�sorted)�logr�devices�e�idevss     r$�fetch_idevsr9<s4��
�D��G�G��y�>�>�>��M�M�M�
�
�
�%�'�'�	
���!�
�
�
��a�h� 1�2�2�
	��I�I�7�8�8�8�8�
,�q�x�
7�
7��I�I�A�B�B�B�B�
�����������G�G�G���C�E�F�F�F�F�F�G������r�w�~�~�d�+�+���r�

�
�I��F�H�.?��F��
�
�
��
��U�W�W�
�U�W�W�
	����
�
�
����F��	
�	
�	
�	
�	
�
����
�I�I�5�s�x�x��7H�7H�I�I�I�=�=�g�=�=�=�G��I�I�9�3�8�8�G�;L�;L�M�M�M�")�3�F�7�O�O�A���t�E��I�I�m�U�#�#�#��Ls/�07�
B;�AB�"B;�:B;�"AD(�( E�
Er�cfg�cloudr5�args�returnc���|�d|�di����}|si}|�dd��}tj|��r|�d||��dStj|dd��}|�t|��}|�d��}|�|}n)t
|t��stj|��}t|���
��}d|�d	|�d
�}	|�d|�d|�d
���	tjdg|	��dS#t$rtj
|d��YdSwxYw)N�	grub_dpkgz	grub-dpkg�enabledTz*%s disabled by config grub_dpkg/enabled=%szgrub-pc/install_deviceszgrub-pc/install_devices_emptyz'grub-pc grub-pc/install_devices string z/
grub-pc grub-pc/install_devices_empty boolean �
z*Setting grub debconf-set-selections with 'z','�'zdebconf-set-selectionsz2Failed to run debconf-set-selections for grub-dpkg)�getr�is_falser+�get_cfg_option_strr9r(�bool�translate_bool�str�lowerrr-r.)
rr:r;r5r<�mycfgr@r8�idevs_empty�	dconf_sels
          r$�handlerMxs���
�G�G�K�����b�!9�!9�:�:�E������i�i�	�4�(�(�G��}�W�����	�	�>��g�N�N�N����#�E�+D�d�K�K�E��}��C� � ���)�)�;�<�<�K����i���
��T�
*�
*�7��)�+�6�6���k�"�"�(�(�*�*�K�K��5�5�+�+�+�	���I�I�I��5�5�+�+�+�	����
O��	�+�,�i�8�8�8�8�8���O�O�O���C�M�N�N�N�N�N�N�O���s�$D<�<E�E)�__doc__r/�loggingr�textwrapr�	cloudinitrr�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemar	r
�cloudinit.settingsr�cloudinit.subpr�MODULE_DESCRIPTIONrr�__annotations__r9rH�listrMr!r&r$�<module>rZs���<�;�;�	�	�	�	������������� � � � � � � � �!�!�!�!�!�!�#�#�#�#�#�#�<�<�<�<�<�<�<�<�+�+�+�+�+�+�0�0�0�0�0�0�
���X�
��
��
9�%�����
�	
�	
�	� "�#���j����(�,�t�
�
��9�9�9�x)O�

�)O��)O�#(�)O�/5�)O�=A�)O�	�)O�)O�)O�)O�)O�)Or&