| Server IP : 23.254.227.96 / Your IP : 216.73.216.21 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 : /lib/python3.6/site-packages/cloudinit/config/__pycache__/ |
Upload File : |
3
��bn � @ s� U d Z ddlZddlmZ ddlmZ ddlmZmZm Z m
Z
ddlmZm
Z
mZ ddlmZ eje�ZeZdgZd d
ded�eed
�ged�Zeddddddddgddd�ddd�d�d�id�id�ZdZe
ee�Z dZdZd d!� Zd"d#� ZdS )$z<Ubuntu Drivers: Interact with third party drivers in Ubuntu.� N)�dedent)�log)�subp�
temp_utils�
type_utils�util)�
MetaSchema�get_meta_doc�validate_cloudconfig_schema)�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
)�id�name�title�description�distrosZexamples� frequency�object�driversF�nvidiazlicense-acceptedZbooleanz(Do you accept the NVIDIA driver license?)�typer �stringzYThe version of the driver to install (e.g. "390", "410"). Defaults to the latest version.)zlicense-accepted�version)r �additionalPropertiesZrequired�
properties)r r r )r r zDubuntu-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.
z�#!/bin/sh
# Allow cloud-init to trigger EULA acceptance via registering a debconf
# template to set linux/nvidia/latelink true
. /usr/share/debconf/confmodule
db_x_loadtemplatefile "$1" cloud-init
c $ C s� t | t�s tdtj| �| f ��d}tjtj| |��}|sLtj d||� d S t
jd�sjtj d� |dg� d}tj| d�}|r�|d j|�7 }tj d
|||r�|nd� t
jdd
�}tjj|d�}tjj|d�}zry4tj|t� tj|tjt�dd� t
j
||g� W n8 tk
�r: } ztjtdt| �� � W Y d d } ~ X nX W d tjj|��rXtj|� X yt
j
ddd|g� W nV t
jk
�r� }
z6t|
jk�r�tjd� nd|
jk�r�tjd� � W Y d d }
~
X nX d S )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-commonr znvidia/versionz:{}z<Installing and activating NVIDIA drivers (%s=%s, version=%s)ZlatestT)Z needs_exeznvidia.templateznvidia-debconf.shi� )�modez.Failed to register NVIDIA debconf template: %sZinstallz--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�debugr Zwhich�formatr Zmkdtemp�os�path�joinZ
write_file�NVIDIA_DEBCONF_CONTENTZencode_text�%NVIDIA_DRIVER_LATELINK_DEBCONF_SCRIPT� ExceptionZlogexc�str�isdirZdel_dirZProcessExecutionError� OLD_UBUNTU_DRIVERS_STDERR_NEEDLE�stderrZwarning�stdout)�cfgZpkg_install_funcZcfgpathZnv_accZ
driver_argZversion_cfgZtdirZdebconf_fileZdebconf_script�e�exc� r/ �'/usr/lib/python3.6/cc_ubuntu_drivers.py�install_driversm s^
r1 c C s8 d|kr|j d| � d S t|t� t|d |jj� d S )Nr z4Skipping module named %s, no 'drivers' key in config)r r
�schemar1 ZdistroZinstall_packages)r
r, Zcloudr Z_argsr/ r/ r0 �handle� s
r3 )�__doc__r! �textwrapr Z cloudinitr Zloggingr r r r Zcloudinit.config.schemar r r
Zcloudinit.settingsr Z getLogger�__name__r r r �metar2 r) r$ r% r1 r3 r/ r/ r/ r0 �<module> sH
E