Your IP : 216.73.217.13


Current Path : /usr/lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_ubuntu_drivers.cpython-38.pyc

U

�Ad��	@s0UdZddlZddlmZddlmZddlmZzddlZdZ	Wne
k
r^dZdZ	YnXddlmZdd	l
mZdd
l
mZmZmZmZddlmZddlmZmZdd
lmZe�e�ZdgZddded�eed�gedgd�Zeed<ee�ZdZ dZ!dZ"ed�dd�Z#e$eeee%dd�dd�Z&dS) z<Ubuntu Drivers: Interact with third party drivers in Ubuntu.�N)�dedent)�Cloud)�DistroTF)�Logger)�log)�subp�
temp_utils�
type_utils�util)�Config)�
MetaSchema�get_meta_doc)�PER_INSTANCEZubuntuZcc_ubuntu_driverszUbuntu Driversz,Interact with third party drivers in Ubuntu.zo        This module interacts with the 'ubuntu-drivers' command to install
        third party driver packages.zN        drivers:
          nvidia:
            license-accepted: true
        �drivers)�id�name�titleZdescription�distrosZexamplesZ	frequencyZactivate_by_schema_keys�metazDubuntu-drivers: error: argument <command>: invalid choice: 'install'z�Template: linux/nvidia/latelink
Type: boolean
Default: true
Description: Late-link NVIDIA kernel modules?
 Enable this to link the NVIDIA kernel modules in cloud-init and
 make them available for use.
�X_LOADTEMPLATEFILE)�distroc
Cs�t|t�s tdt�|�|f��d}t�t�||��}|sLt�	d||�dSt
�d�sjt�	d�|dg�d}t�|d�}|r�|d	�|�7}t�	d
|||r�|nd�t
j|��dd
�}tj�|d�}zpz2t�|t�t�d��}	|	�t|�W5QRXWn8tk
�r0}
zt�tdt|
���W5d}
~
XYnXW5tj�|��rNt�|�Xzt
�
ddd|g�WnVt
jk
�r�}z4t|j k�r�t�!d�nd|j"k�r�t�!d��W5d}~XYnXdS)Nz.'drivers' config expected dict, found '%s': %sznvidia/license-acceptedz$Not installing NVIDIA drivers. %s=%szubuntu-driverszI'ubuntu-drivers' command not available.  Installing ubuntu-drivers-commonzubuntu-drivers-commonZnvidiaznvidia/versionz:{}z<Installing and activating NVIDIA drivers (%s=%s, version=%s)ZlatestT)�dirZ	needs_exeznvidia.templatez
cloud-initz.Failed to register NVIDIA debconf template: %s�installz--gpgpuz[the available version of ubuntu-drivers is too old to perform requested driver installationz"No drivers found for installation.z0ubuntu-drivers found no drivers for installation)#�
isinstance�dict�	TypeErrorr	Zobj_namer
Ztranslate_boolZget_cfg_by_path�LOG�debugrZwhich�formatrZmkdtempZget_tmp_exec_path�os�path�join�isdirZdel_dirZ
write_file�NVIDIA_DEBCONF_CONTENT�debconfZDebconfCommunicatorZcommandr�	ExceptionZlogexc�strZProcessExecutionError� OLD_UBUNTU_DRIVERS_STDERR_NEEDLE�stderr�warning�stdout)�cfgZpkg_install_funcrZcfgpathZnv_accZ
driver_argZversion_cfgZtdirZdebconf_fileZdc�e�exc�r.�D/usr/lib/python3/dist-packages/cloudinit/config/cc_ubuntu_drivers.py�install_driversOsf
��
�

���
r0)rr+�cloudr�args�returncCsFd|kr|�d|�dSts,|�d|�dSt|d|jj|j�dS)Nrz4Skipping module named %s, no 'drivers' key in configz<Skipping module named %s, 'python3-debconf' is not installed)r�HAS_DEBCONFr)r0rZinstall_packages)rr+r1rr2r.r.r/�handle�s��r5)'�__doc__r�textwraprZcloudinit.cloudrZcloudinit.distrosrr$r4�ImportErrorZloggingrZ	cloudinitrrrr	r
Zcloudinit.configrZcloudinit.config.schemarr
Zcloudinit.settingsrZ	getLogger�__name__rrr�__annotations__r'r#rr0r&�listr5r.r.r.r/�<module>sZ

���	��

A�