Server IP : 23.254.227.96 / Your IP : 216.73.216.7 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3.6/site-packages/cloudinit/config/__pycache__/ |
Upload File : |
3 ��b� � @ sD d Z ddlZddlmZmZ ddlmZ ddgZdd� Zd d � Z dS )a� Grub Dpkg --------- **Summary:** configure grub debconf installation device Configure which device is used as the target for grub installation. This module should work correctly by default without any user configuration. It 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. **Internal name:** ``cc_grub_dpkg`` **Module frequency:** per instance **Supported distros:** ubuntu, debian **Config keys**:: grub_dpkg: enabled: <true/false> grub-pc/install_devices: <devices> grub-pc/install_devices_empty: <devices> grub-dpkg: (alias for grub_dpkg) � N)�subp�util)�ProcessExecutionErrorZubuntuZdebianc C sX d}g }y"t j ddddgdd�d j� }W np tk r| } z6t|jt�rT| jd � nd |jkrj| jd� n� W Y dd}~X n tk r� t j | d � Y nX | s�tjj |� r�dS y(t j dddd|gdd�d j� j� }W n" tk r� t j | d|� Y nX | jddj|�� dd� |D �}| jddj|�� |�rDt|�d n|}| jd|� |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)Zcapturer z'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�,c S s g | ]}d |kr|�qS )z disk/by-id� )�.0Zdevr r �"/usr/lib/python3.6/cc_grub_dpkg.py� <listcomp>g s zfetch_idevs.<locals>.<listcomp>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 Zdevices�e�idevsr r r �fetch_idevs4 s: r c C s� |j d|j di ��}|si }|j dd�}tj|�rD|jd| |� d S tj|dd �}tj|dd �}|d krpt|�}|d kr�|r�dnd }d ||f } |jd||f � ytjdg| � W n tk r� tj|d � Y nX d S )NZ grub_dpkgz grub-dpkg�enabledTz*%s disabled by config grub_dpkg/enabled=%szgrub-pc/install_deviceszgrub-pc/install_devices_emptyZfalse�truez[grub-pc grub-pc/install_devices string %s grub-pc grub-pc/install_devices_empty boolean %s z2Setting grub debconf-set-selections with '%s','%s'zdebconf-set-selectionsz2Failed to run debconf-set-selections for grub-dpkg) �getr Zis_falser Zget_cfg_option_strr r r r ) �nameZcfgZ_cloudr Z_argsZmycfgr r Zidevs_emptyZ dconf_selr r r �handlep s. r# ) �__doc__r Z cloudinitr r Zcloudinit.subpr Zdistrosr r# r r r r �<module>* s <