U
    ¯Ady  ã                	   @   s²   U d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZmZ ddlmZ dd	lmZ d
Zdddeegeg g dœZeed< eeƒZ dZee	eeeddœdd„ZdS )zScripts User: Run user scriptsé    N)ÚLogger)Úsubp)ÚCloud)ÚConfig)Ú
MetaSchemaÚget_meta_doc)ÚALL_DISTROS)ÚPER_INSTANCEa   This module runs all user scripts. User scripts are not specified in the
``scripts`` directory in the datasource, but rather are present in the
``scripts`` dir in the instance configuration. Any cloud-config parts with a
``#!`` will be treated as a script and run. Scripts specified as cloud-config
parts will be run in the order they are specified in the configuration.
This module does not accept any config keys.
Zcc_scripts_userzScripts UserzRun user scripts)ÚidÚnameÚtitleZdescriptionZdistrosZ	frequencyZexamplesZactivate_by_schema_keysÚmetaZscripts)r   ÚcfgÚcloudÚlogÚargsÚreturnc              	   C   sL   t j | ¡ t¡}zt |¡ W n& tk
rF   | d| t|¡ ‚ Y nX d S )Nz"Failed to run module %s (%s in %s))	ÚosÚpathÚjoinZget_ipath_curÚSCRIPT_SUBDIRr   ZrunpartsÚ	ExceptionZwarning)r   r   r   r   r   Zrunparts_path© r   úB/usr/lib/python3/dist-packages/cloudinit/config/cc_scripts_user.pyÚhandle.   s    ür   )Ú__doc__r   Zloggingr   Z	cloudinitr   Zcloudinit.cloudr   Zcloudinit.configr   Zcloudinit.config.schemar   r   Zcloudinit.distrosr   Zcloudinit.settingsr	   ZMODULE_DESCRIPTIONr   Ú__annotations__r   ÚstrÚlistr   r   r   r   r   Ú<module>   s6   
ø    þ