ó
oBú]c @ sq d Z d d l m Z d d l m Z d d l m Z d d l m Z e Z d d d d d
d g Z d 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( t util( t PER_INSTANCEt pub_key_dsat pub_key_rsat
pub_key_ecdsat instance_idt hostnamet fqdnc C sÁ t | d k r( t j | d } n* d | k rH | j d | d S| d } d | k rr | j d | d S| d } | j d d } | j d } y t | } Wn* t k
rŮ d } t j | d
| n X| d k rď t } n i } | j
| d <| j | d <| j d
t | d
<i d d 6d d 6d d 6}
xX |
j
D]J \ } } y t j | | | <WqSt k
rt j | d | qSXqSWi }
xE | D]= } | | k rŃ| | |
| <qŽd |
| <| j d | qŽWi } xC |
j
D]5 \ } } | d k r'd | | <qt | | | <qWi | d d 6} t j | | } y5 t j | d | d | d d d t j | j Wn' t k
rźt j | d | | n Xd S( Ni t
phone_homes= Skipping module named %s, no 'phone_home' configuration foundt urlsF Skipping module named %s, no 'url' found in 'phone_home' configurationt postt allt triesi
s? Configuration entry 'tries' is not an integer, using %s insteadR R R s /etc/ssh/ssh_host_dsa_key.pubR s /etc/ssh/ssh_host_rsa_key.pubR s /etc/ssh/ssh_host_ecdsa_key.pubR s1 %s: failed to open, can not phone home that data!s= Requested key %s from 'post' configuration list not availables N/At INSTANCE_IDt datat retriest sec_betweeni t ssl_detailss0 Failed to post phone home data to %s in %s tries( t lenR t read_conft debugt warningt gett intt Exceptiont logexct
POST_LIST_ALLt get_instance_idt get_hostnamet Truet itemst load_filet Nonet strR t
render_stringR t read_file_or_urlt fetch_ssl_detailst paths( t namet cfgt cloudt logt argst ph_cfgR t post_listR t all_keyst pubkeyst nt patht submit_keyst kt real_submit_keyst vt
url_params( ( sB /usr/lib/python2.7/site-packages/cloudinit/config/cc_phone_home.pyt handleG st
N(
t __doc__t cloudinitR R R t cloudinit.settingsR t frequencyR R8 ( ( ( sB /usr/lib/python2.7/site-packages/cloudinit/config/cc_phone_home.pyt <module>) s