o
    ¦®Øfx  ã                
   @   s¤   U d Z ddl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 ddlmZ d	eged
gdœZe
ed< e e¡Zdededededdf
dd„ZdS )zERuncmd: run arbitrary commands at rc.local with output to the consoleé    N)Úutil)ÚCloud)ÚConfig)Ú
MetaSchema)ÚALL_DISTROS)ÚPER_INSTANCEÚ	cc_runcmdÚruncmd)ÚidÚdistrosÚ	frequencyÚactivate_by_schema_keysÚmetaÚnameÚcfgÚcloudÚargsÚreturnc              
   C   s€   d|vrt  d| ¡ d S tj | d¡d¡}|d }zt |¡}t ||d¡ W d S  t	y? } z
t
|ƒd ||¡ƒ‚d }~ww )Nr	   z:Skipping module named %s, no 'runcmd' key in configurationÚscriptsiÀ  z"Failed to shellify {} into file {})ÚLOGÚdebugÚosÚpathÚjoinÚ	get_ipathr   ÚshellifyÚ
write_fileÚ	ExceptionÚtypeÚformat)r   r   r   r   Úout_fnÚcmdÚcontentÚe© r$   ú</usr/lib/python3/dist-packages/cloudinit/config/cc_runcmd.pyÚhandle%   s   ÿ
€ÿr&   )Ú__doc__Úloggingr   Ú	cloudinitr   Úcloudinit.cloudr   Úcloudinit.configr   Úcloudinit.config.schemar   Úcloudinit.distrosr   Úcloudinit.settingsr   r   Ú__annotations__Ú	getLoggerÚ__name__r   ÚstrÚlistr&   r$   r$   r$   r%   Ú<module>   s    	ü
"