ó oBú]c @sšdZddlZddlmZddlmZmZddlmZ ddl m Z ddlm Z ddlm Z dd lmZe jeƒZe Zd gZi d d 6d d6dd6edƒd6ed6edƒgd6ed6dd6iidd6ed6iidd6ed6dgd6iidd6dd6d6idd6dd6d 6d!6d"6d!6d#6d!6Zd$ZeeƒZd%Zd&Zd'„Zd(„ZdS()s<Ubuntu Drivers: Interact with third party drivers in Ubuntu.iÿÿÿÿN(tdedent(tget_schema_doctvalidate_cloudconfig_schema(tlog(t PER_INSTANCE(t temp_utils(t type_utils(tutiltubuntutcc_ubuntu_driverstidsUbuntu Driverstnames,Interact with third party drivers in Ubuntu.ttitleso This module interacts with the 'ubuntu-drivers' command to install third party driver packages.t descriptiontdistrossN drivers: nvidia: license-accepted: true texamplest frequencytobjectttypetadditionalPropertiesslicense-acceptedtrequiredtbooleans(Do you accept the NVIDIA driver license?tstringsYThe version of the driver to install (e.g. "390", "410"). Defaults to the latest version.tversiont propertiestnvidiatdriverssDubuntu-drivers: error: argument : invalid choice: 'install'sÉ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. sÅ#!/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 CsJt|tƒs1tdtj|ƒ|fƒ‚nd}tjtj||ƒƒ}|sotj d||ƒdStj dƒs›tj dƒ|dgƒnd}tj|dƒ}|rÏ|d j |ƒ7}ntj d |||rê|nd ƒt j d tƒ}tjj|d ƒ}tjj|dƒ}z|yFtj|tƒtj|tjtƒddƒtj||gƒWn/tk r§} tjtdt| ƒƒ‚nXWdtjj|ƒrÎtj|ƒnXytjddd|gƒWnWtjk rE} t| jkr tjdƒnd| j kr?tjdƒn‚nXdS(Ns.'drivers' config expected dict, found '%s': %ssnvidia/license-accepteds$Not installing NVIDIA drivers. %s=%ssubuntu-driverssI'ubuntu-drivers' command not available. Installing ubuntu-drivers-commonsubuntu-drivers-commonRsnvidia/versions:{}s<Installing and activating NVIDIA drivers (%s=%s, version=%s)tlatestt needs_exesnvidia.templatesnvidia-debconf.shtmodeiís.Failed to register NVIDIA debconf template: %stinstalls--gpgpus[the available version of ubuntu-drivers is too old to perform requested driver installations"No drivers found for installation.s0ubuntu-drivers found no drivers for installation(!t isinstancetdictt TypeErrorRtobj_nameRttranslate_booltget_cfg_by_pathtLOGtdebugtwhichtformatRtmkdtemptTruetostpathtjoint write_filetNVIDIA_DEBCONF_CONTENTt encode_textt%NVIDIA_DRIVER_LATELINK_DEBCONF_SCRIPTtsubpt Exceptiontlogexctstrtisdirtdel_dirtProcessExecutionErrort OLD_UBUNTU_DRIVERS_STDERR_NEEDLEtstderrtwarningtstdout( tcfgtpkg_install_functcfgpathtnv_acct driver_argt version_cfgttdirt debconf_filetdebconf_scripttetexc((sF/usr/lib/python2.7/site-packages/cloudinit/config/cc_ubuntu_drivers.pytinstall_drivers`sV   cCsHd|kr |jd|ƒdSt|tƒt|d|jjƒdS(NRs4Skipping module named %s, no 'drivers' key in config(R&RtschemaRHtdistrotinstall_packages(R R=tcloudRt_args((sF/usr/lib/python2.7/site-packages/cloudinit/config/cc_ubuntu_drivers.pythandlešs   (t__doc__R+ttextwrapRtcloudinit.config.schemaRRt cloudinitRtloggingtcloudinit.settingsRRRRt getLoggert__name__R%RRtFalseRIR9R/R1RHRN(((sF/usr/lib/python2.7/site-packages/cloudinit/config/cc_ubuntu_drivers.pytsX      "   :