Current File : //lib/python2.7/site-packages/cloudinit/config/cc_phone_home.pyo
�
oB�]c@sqdZddlmZddlmZddlmZddlmZeZdddd	d
dgZd�Z	d
S(s�
Phone Home
----------
**Summary:** post data to url

This module can be used to post data to a remote host after boot is complete.
If the post url contains the string ``$INSTANCE_ID`` it will be replaced with
the id of the current instance. Either all data can be posted or a list of
keys to post. Available keys are:

    - ``pub_key_dsa``
    - ``pub_key_rsa``
    - ``pub_key_ecdsa``
    - ``instance_id``
    - ``hostname``
    - ``fdqn``

**Internal name:** ``cc_phone_home``

**Module frequency:** per instance

**Supported distros:** all

**Config keys**::

    phone_home:
        url: http://example.com/$INSTANCE_ID/
        post:
            - pub_key_dsa
            - instance_id
            - fqdn
        tries: 10
i����(t	templater(t
url_helper(tutil(tPER_INSTANCEtpub_key_dsatpub_key_rsat
pub_key_ecdsatinstance_idthostnametfqdncCs�t|�dkr(tj|d�}n*d|krH|jd|�dS|d}d|krr|jd|�dS|d}|jdd�}|jd�}yt|�}Wn*tk
r�d	}tj|d
|�nX|dkr�t	}ni}	|j
�|	d<|j�|	d<|jd
t�|	d
<idd6dd6dd6}
xX|
j
�D]J\}}ytj|�|	|<WqStk
r�tj|d|�qSXqSWi}
xE|D]=}||	kr�|	||
|<q�d|
|<|jd|�q�Wi}xC|
j
�D]5\}}|dkr'd||<qt|�||<qWi|	dd6}tj||�}y5tj|d|d|dddtj|j��Wn'tk
r�tj|d||�nXdS(Nit
phone_homes=Skipping module named %s, no 'phone_home' configuration foundturlsFSkipping module named %s, no 'url' found in 'phone_home' configurationtposttallttriesi
s?Configuration entry 'tries' is not an integer, using %s insteadRRR	s/etc/ssh/ssh_host_dsa_key.pubRs/etc/ssh/ssh_host_rsa_key.pubRs/etc/ssh/ssh_host_ecdsa_key.pubRs1%s: failed to open, can not phone home that data!s=Requested key %s from 'post' configuration list not availablesN/AtINSTANCE_IDtdatatretriestsec_betweenitssl_detailss0Failed to post phone home data to %s in %s tries(tlenRt	read_conftdebugtwarningtgettintt	Exceptiontlogexct
POST_LIST_ALLtget_instance_idtget_hostnametTruetitemst	load_filetNonetstrRt
render_stringRtread_file_or_urltfetch_ssl_detailstpaths(tnametcfgtcloudtlogtargstph_cfgRt	post_listRtall_keystpubkeystntpathtsubmit_keystktreal_submit_keystvt
url_params((sB/usr/lib/python2.7/site-packages/cloudinit/config/cc_phone_home.pythandleGst	
	

	



	

N(
t__doc__t	cloudinitRRRtcloudinit.settingsRt	frequencyRR8(((sB/usr/lib/python2.7/site-packages/cloudinit/config/cc_phone_home.pyt<module>)s