HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_rightscale_userdata.cpython-36.pyc
3

\�me#�	@s�UddlZddlZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
mZddlmZdd	lmZd
ZdZdZd
d
deegeggd�Ze
ee�Zeje�Zeee	edd�dd�ZdS)�N)�parse_qs)�
url_helper)�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�ALL_DISTROS)�PER_INSTANCEZcc_rightscale_userdataZCLOUD_INIT_REMOTE_HOOKaIThis module adds support for RightScale configuration hooks to cloud-init.
RightScale adds an 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

**Raw user data schema**::

    CLOUD_INIT_REMOTE_HOOK=<url>
zRightScale Userdataz&Support rightscale configuration hooks)�id�name�title�descriptionZdistrosZ	frequencyZexamplesZactivate_by_schema_keys)r�cfg�cloud�args�returncCs�t|dd�}|st|�r,tjd|�dS|�}y,t|�}|sJt|kr\tjd|t�dSWn$tk
r�tjtd|��YnXg}g}|j	d�}	|t}
x�t
|
�D]�\}}tjj
|	d|�}
y6tj|�}|j�r�|jr�tj|
|dd�|j|
�Wq�tk
�r8}z"|j|�tjtd	t||
�WYdd}~Xq�Xq�W|�rTtjd
t|��t|�t|
�k�r�t|
�t|�}tjd|�|�r�tjdt|��|d�dS)N�get_userdata_rawz'Failed to get raw userdata in module %sz:Skipping module %s, did not find %s in parsed raw userdataz1Failed to parse query string %s into a dictionary�scriptszrightscale-%02ii�)�modez!%s failed to read %s and write %sz)Wrote out rightscale userdata to %s filesz%s urls were skipped or failedz2%s failed with exceptions, re-raising the last one����)�getattr�callable�LOG�debugr�MY_HOOKNAME�	ExceptionrZlogexcZ
get_ipath_cur�	enumerate�os�path�join�uhelpZreadurl�ok�contentsZ
write_file�append�MY_NAME�lenZwarning)rrrrrZudZmdictZ	wrote_fnsZcaptured_excpsZ	scripts_dZurls�iZurlZfnameZresp�eZskipped�r*�,/usr/lib/python3.6/cc_rightscale_userdata.py�handleJsT



$
r,)ZloggingrZurllib.parserZ	cloudinitrr"rZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarrZcloudinit.distrosr	Zcloudinit.settingsr
r&rZMODULE_DESCRIPTION�meta�__doc__Z	getLogger�__name__r�str�listr,r*r*r*r+�<module>	s0