3
\¼mee ã @ s² U d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m
Z
mZ ddlm
Z
ddlmZ d Zd
ddee
geg g d
œZe
eeƒZ ejeƒZdZeeeeddœdd„ZdS )zScripts User: Run user scriptsé N)Ú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.
Zcc_scripts_userzScripts UserzRun user scripts)ÚidÚnameÚtitleÚdescriptionZdistrosZ frequencyZexamplesZactivate_by_schema_keysÚscripts)r
ÚcfgÚcloudÚargsÚreturnc C sL t jj|jƒ tƒ}ytj|ƒ W n& tk
rF tj d| t|ƒ ‚ Y nX d S )Nz"Failed to run module %s (%s in %s))
ÚosÚpathÚjoinZ
get_ipath_curÚ
SCRIPT_SUBDIRr ZrunpartsÚ ExceptionÚLOGZwarning)r
r r r Z
runparts_path© r ú%/usr/lib/python3.6/cc_scripts_user.pyÚhandle/ s r )Ú__doc__Zloggingr Z cloudinitr Zcloudinit.cloudr Zcloudinit.configr Zcloudinit.config.schemar r Zcloudinit.distrosr Zcloudinit.settingsr ZMODULE_DESCRIPTIONÚmetaZ getLoggerÚ__name__r r ÚstrÚlistr r r r r Ú