
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3
\¼meà  ã               @   st   d dl Z d dlZd dl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 ejeƒZG dd„ dƒZdS )	é    N)ÚOptional)ÚDistro)ÚPathsÚRunners)Úevents)Ú
DataSourcec               @   s¨   e Zd Zd!eeeeeee	j
 dœdd„Zedd„ ƒZd"dd	„Zd
d„ Zd#dd„Zdd„ Zedd„ ƒZdd„ Zdd„ Zd$dd„Zdd„ Zd%dd„Zd&dd„Zd'dd „ZdS )(ÚCloudN)Ú
datasourceÚpathsÚcfgÚdistroÚrunnersÚreporterc             C   s@   || _ || _|| _|| _|| _|d kr6tjdddd�}|| _d S )Nzunnamed-cloud-reporterF)ÚnameÚdescriptionZreporting_enabled)r	   r
   r   Ú_cfgÚ_runnersr   ÚReportEventStackr   )Úselfr	   r
   r   r   r   r   © r   ú/usr/lib/python3.6/cloud.pyÚ__init__    s    	zCloud.__init__c             C   s   t j| jƒS )N)ÚcopyÚdeepcopyr   )r   r   r   r   r   6   s    z	Cloud.cfgFc             C   s   | j j|||||ƒS )N)r   Úrun)r   r   ZfunctorÚargsZfreqZclear_on_failr   r   r   r   ;   s    z	Cloud.runc             C   s6   | j j| }tjj|ƒs2tjdtjj|ƒ|ƒ d S |S )Nz-No template found in %s for template named %s)r
   Ztemplate_tplÚosÚpathÚisfileÚLOGZwarningÚdirname)r   r   Úfnr   r   r   Úget_template_filename>   s    
zCloud.get_template_filenameTc             C   s   | j j|ƒS )N)r	   Úget_userdata)r   Zapply_filterr   r   r   r#   J   s    zCloud.get_userdatac             C   s
   | j jƒ S )N)r	   Úget_instance_id)r   r   r   r   r$   M   s    zCloud.get_instance_idc             C   s   | j jS )N)r	   Úlaunch_index)r   r   r   r   r%   P   s    zCloud.launch_indexc             C   s
   | j jƒ S )N)r	   Úget_public_ssh_keys)r   r   r   r   r&   T   s    zCloud.get_public_ssh_keysc             C   s
   | j jƒ S )N)r	   Ú
get_locale)r   r   r   r   r'   W   s    zCloud.get_localec             C   s   | j j||d�S )N)ÚfqdnÚmetadata_only)r	   Úget_hostname)r   r(   r)   r   r   r   r*   Z   s    zCloud.get_hostnamec             C   s   | j j|ƒS )N)r	   Údevice_name_to_device)r   r   r   r   r   r+   _   s    zCloud.device_name_to_devicec             C   s   | j j|ƒS )N)r
   Úget_ipath_cur)r   r   r   r   r   r,   b   s    zCloud.get_ipath_curc             C   s   | j j|ƒS )N)r
   Ú	get_cpath)r   r   r   r   r   r-   e   s    zCloud.get_cpathc             C   s   | j j|ƒS )N)r
   Ú	get_ipath)r   r   r   r   r   r.   h   s    zCloud.get_ipath)N)NF)T)FF)N)N)N)Ú__name__Ú
__module__Ú__qualname__r   r   Údictr   r   r   r   r   r   Úpropertyr   r   r"   r#   r$   r%   r&   r'   r*   r+   r,   r-   r.   r   r   r   r   r      s    




r   )r   Zloggingr   Ztypingr   Zcloudinit.distrosr   Zcloudinit.helpersr   r   Zcloudinit.reportingr   Zcloudinit.sourcesr   Z	getLoggerr/   r   r   r   r   r   r   Ú<module>   s   
