3
\¼me< ã @ 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 )z.Scripts Per Instance: Run per instance scriptsé N)Úsubp)ÚCloud)ÚConfig)Ú
MetaSchemaÚget_meta_doc)ÚALL_DISTROS)ÚPER_INSTANCEa[ Any scripts in the ``scripts/per-instance`` directory on the datasource will
be run when a new instance is first booted. Scripts will be run in alphabetical
order. This module does not accept any config keys.
Some cloud platforms change instance-id if a significant change was made to
the system. As a result per-instance scripts will run again.
Zcc_scripts_per_instancezScripts Per InstancezRun per instance scripts)ÚidÚnameÚtitleÚdescriptionZdistrosZ frequencyZexamplesZactivate_by_schema_keyszper-instance)r
ÚcfgÚcloudÚargsÚreturnc C sN t jj|jƒ dtƒ}ytj|ƒ W n& tk
rH tj d| t|ƒ ‚ Y nX d S )NÚscriptsz"Failed to run module %s (%s in %s))
ÚosÚpathÚjoinZ get_cpathÚ
SCRIPT_SUBDIRr ZrunpartsÚ ExceptionÚLOGZwarning)r
r
r r Z
runparts_path© r ú-/usr/lib/python3.6/cc_scripts_per_instance.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 Ú