Current File : //lib/python2.7/site-packages/cloudinit/config/cc_rightscale_userdata.pyc
�
oB�]c@sqdZddlZddlmZddlmZddlmZddlm	Z	eZ
dZdZd	�Z
dS(
s
Rightscale Userdata
-------------------
**Summary:** support rightscale configuration hooks

This module adds support for RightScale configuration hooks to cloud-init.
RightScale adds a entry in the format ``CLOUD_INIT_REMOTE_HOOK=http://...`` to
ec2 user-data. This module checks for this line in the raw userdata and
retrieves any scripts linked by the RightScale user data and places them in the
user scripts configuration directory, to be run later by ``cc_scripts_user``.

.. note::
    the ``CLOUD_INIT_REMOTE_HOOK`` config variable is present in the raw ec2
    user data only, not in any cloud-config parts

**Internal name:** ``cc_rightscale_userdata``

**Module frequency:** per instance

**Supported distros:** all

**Config keys**::

    CLOUD_INIT_REMOTE_HOOK=<url>
i����N(tPER_INSTANCE(t
url_helper(tutil(tparse_qstcc_rightscale_userdatatCLOUD_INIT_REMOTE_HOOKcCsy|j�}Wn"tk
r4|jd|�dSXy:t|�}|sWt|krn|jd|t�dSWn'tk
r�tj|d|��nXg}g}|jd�}	|t}
x�t|
�D]�\}}t	j
j|	d|�}
yNtj
|�}|j�r=|jr=tj|
|dd�|j|
�nWq�tk
ry}|j|�tj|dt||
�q�Xq�W|r�|jd	t|��nt|�t|
�kr�t|
�t|�}|jd
|�n|r|jdt|��|d�ndS(
Ns'Failed to get raw userdata in module %ss:Skipping module %s, did not find %s in parsed raw userdatas1Failed to parse query string %s into a dictionarytscriptssrightscale-%02itmodei�s!%s failed to read %s and write %ss)Wrote out rightscale userdata to %s filess%s urls were skipped or faileds2%s failed with exceptions, re-raising the last onei����(tget_userdata_rawt	ExceptiontdebugRtMY_HOOKNAMERtlogexct
get_ipath_curt	enumeratetostpathtjointuhelptreadurltoktcontentst
write_filetappendtMY_NAMEtlentwarning(tnamet_cfgtcloudtlogt_argstudtmdictt	wrote_fnstcaptured_excpst	scripts_dturlstiturltfnametresptetskipped((sK/usr/lib/python2.7/site-packages/cloudinit/config/cc_rightscale_userdata.pythandleBsN
	



	
(t__doc__Rtcloudinit.settingsRt	cloudinitRRRtsix.moves.urllib_parseRt	frequencyRRR,(((sK/usr/lib/python2.7/site-packages/cloudinit/config/cc_rightscale_userdata.pyt<module>!s