HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1784574/root/usr/lib/python3/dist-packages/cloudinit/cmd/__pycache__/
Upload File :
Current File : //proc/1784574/root/usr/lib/python3/dist-packages/cloudinit/cmd/__pycache__/main.cpython-311.pyc
�

܍~c�����ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZe	j��ddl
mZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZmZmZm Z ddlm!Z!ddl"m#Z#ddlm$Z$ddl%m&Z&dZ'dZ(eeed�Z)ej*��Z+d5d�Z,d6d�Z-d�Z.d�Z/defd�Z0d �Z1d7d"�Z2d8d$ee3e4ffd%�Z5d&�Z6d'�Z7d(�Z8d)�Z9d*�Z:d+�Z;d9d,�Z<d-ej=fd.�Z>d/�Z?d0�Z@d6d1�ZAeBd2kr7d3ejCvr
d4ejCd3<eAejD��ZEeErejFeE��dSdSdS):�N)�Tuple)�patcher)�Modules)�validate_cloudconfig_schema)�log)�netinfo)�signal_handler)�sources)�stages)�
url_helper)�util)�version)�warnings)�	reporting)�events)�PER_INSTANCE�
PER_ALWAYS�PER_ONCE�CLOUD_CONFIG)�
atomic_helper)�cc_set_hostname)�
dhclient_hook)�read_cfg_pathszOCloud-init v. {version} running '{action}' at {timestamp}. Up {uptime} seconds.zcloud_%s_modules)�instance�always�once�c��|r"tj�d|z��tj�d��tj�d��tjtj���tj�d��tj�d��dS)N�%s
z<------------------------------------------------------------�
)�file)�sys�stderr�write�	traceback�	print_exc��msgs �4/usr/lib/python3/dist-packages/cloudinit/cmd/main.pyr&r&Ls���
�)��
����3��(�(�(��J���X�����J���T����
��S�Z�(�(�(�(��J���X�����J���T������c�h�|st|��}tjd|zddt���|S)NrFT)�consoler#r)�welcome_formatr
�	multi_log�LOG)�actionr(s  r)�welcomer1Vs9���%��V�$�$���N�6�S�>�5��3�G�G�G�G��Jr*c��t�tj��t	j��t	j��|���S)N)r�uptime�	timestampr0)�WELCOME_MSG_TPL�formatr�version_stringr
r3�time_rfc2822�r0s r)r-r-]sC���!�!��&�(�(��{�}�}��#�%�%��	"���r*c��g}|jrA|jD]9}|�tj�|j�����:|S�N)�files�append�os�path�realpath�name)�args�fn_cfgs�fhs   r)�extract_fnsrEfsR���G��z�6��*�	6�	6�B�
�N�N�2�7�+�+�B�G�4�4�5�5�5�5��Nr*�modsc��t|z}|�|��\}}t|��t|��z}|dkrGd|�d|�d�}tj�d|z��t�|��gSt�dt|��t|����|S)NrzNo 'z ' modules to run under section '�'rzRan %s modules with %s failures)�MOD_SECTION_TPL�run_section�lenr"r#r$r/�debug)rF�action_name�section�full_section_name�	which_ran�failures�total_attemptedr(s        r)�run_module_sectionrSss���'�7�3�� �,�,�->�?�?��Y���)�n�n�s�8�}�}�4�O��!�����K�K����
��	�
����3��(�(�(��	�	�#�����	��	�	�-�s�9�~�~�s�8�}�}�	
�	
�	
��r*c��|�d��r)tj|�d����dSdS)Nr)�getr�update_configuration)�cfgs r)�apply_reporting_cfgrX�sC��
�w�w�{���=��&�s�w�w�{�';�';�<�<�<�<�<�=�=r*��cloud-config-url�urlc��tj|��}|D]}||vr|||fcS�td|�d|�d����)Nz	No keys (z) found in string 'rH)r
�keyval_str_to_dict�KeyError)�cmdline�names�data�keys    r)�parse_cmdline_urlrc�s`���"�7�+�+�D��"�"���$�;�;���S�	�>�!�!�!��
�(�'�'�'�5�5�5�I�
J�
J�Jr*T�returnc��|�tj��}	t|��\}}n#t$rtjdfcYSwxYw|�d��p|�d��}|r^tj�	|��r?|r$d|�d|�d�}tj
}|rtj}nd|�d|�d�}tj}||fS|d	d
dd�}|s|rtj}d
|d<ntj}d|d<d}	d}
	tj
d#i|��}d}|���r�d}
t|tj��r]	|t#|�t'|
�������z
}n#t($rYnwxYw|�|
��sd}
n|j�|
��sd}
|
r!|dkrt,�d��nF|dkr
tj}ntj
}|d|�dt1|
����fS|d|�d|j�d�fS||jz}	n&#tj$r}|d|�d|��fcYd}~Sd}~wwxYwtj||	d���tj
d |�d!|�d"|��fS)$a�Write data from url referenced in command line to path.

    path: a file to write content to if downloaded.
    network: should network access be assumed.
    cmdline: the cmdline to parse for cloud-config-url.

    This is used in MAAS datasource, in "ephemeral" (read-only root)
    environment where the instance netboots to iscsi ro root.
    and the entity that controls the pxe config has to configure
    the maas datasource.

    An attempt is made on network urls even in local datasource
    for case of network set up in initramfs.

    Return value is a tuple of a logger function (logging.DEBUG)
    and a message indicating what happened.
    Nz!No kernel command line url found.zfile://�/zfile 'zC' existed, possibly from local stage download of command line url 'z'. Not re-writing.zE' existed, possibly from previous boot download of command line url '�
�T)r[�timeout�retries�stream��sec_betweeng�������?s
#cloud-configr*)�
chunk_sizeFr[z�DEPRECATED: `url` kernel command line key is deprecated for providing cloud-config via URL. Please use `cloud-config-url` kernel command line parameter insteadrZz
contents of 'z' did not start with zurl 'z' returned code z. Ignoring.zretrieving url 'z
' failed: i�)�modezwrote cloud-config data from z='z' to �)r
�get_cmdlinercr^�logging�DEBUG�
startswithr>r?�exists�INFO�WARNr�read_file_or_url�ok�
isinstance�UrlResponse�next�iter_contentrK�
StopIteration�contentsr/�warning�str�code�UrlError�
write_file)r?�networkr_�cmdline_namer[�
path_is_local�m�level�kwargsra�header�resp�sniffed_content�is_cloud_cfg�es               r)�attempt_cmdline_urlr��sz��&���"�$�$��D�-�g�6�6���c�c���D�D�D��
�B�C�C�C�C�D�����N�N�9�-�-�D�����1D�1D�M��������-�-���
	!�
	!�AE���c�c�c�K�
��L�E��
&��
���
	!�AE���c�c�c�K�
��L�E��q�z���R�A��
F�
F�F��$�-�$���� !��}����
�� #��}���D�
�F�)D��*�4�4�V�4�4�����7�7�9�9�"	��L��$�
� 6�7�7�

%��#�t��)�)�S��[�[�)�A�A�(�(��O�O��%�����D�����&�1�1�&�9�9�)�#(�L���]�-�-�f�5�5�
%�$���
��5�(�(��K�K�-����� �#5�5�5�#�L�E�E�#�L�E��K�C�K�K�c�&�k�k�K�K�����:=�#�#�t�y�y�y�I��
����.������D�D�D���3�3�3���B�C�C�C�C�C�C�C�����D����	�O�D�$�U�+�+�+�+�����<�<����d�d�	$��s_�*�A�A�AH5�	3E=�<H5�=
F
�H5�	F
�
BH5�H5�*
H5�5I�	I�
I�Ic��dtjjtjjfz}tj�|j�d��d��}tj�	|��rot|�����}||krFt�
d��|�d��tj||��dSdStj�	|j�d����rt�d��tj||��dS)	z�Purge the cache if python version changed on us.

    There could be changes not represented in our cache (obj.pkl) after we
    upgrade to a new version of python, so at that point clear the cache
    z%d.%drazpython-versionz-Python version change detected. Purging cacheT�obj_pklzMWriting python-version file. Cache compatibility status is currently unknown.N)r"�version_info�major�minorr>r?�join�paths�	get_cpathru�open�readr/rL�purge_cacher
r��
get_ipath_cur�info)�init�current_python_version�python_version_path�cached_python_versions    r)�$purge_cache_on_python_version_changer��s@��%�������(����'�,�,��
���V�$�$�&6����
�w�~�~�)�*�*�E� $�%8� 9� 9� >� >� @� @��!�$:�:�:��I�I�E�F�F�F����T�"�"�"��O�/�1G�H�H�H�H�H�;�:�
�7�>�>�$�*�2�2�9�=�=�>�>�	��H�H�C�
�
�
�	
��+�-C�D�D�D�D�Dr*c�J�tj|jd��rdS|jS)N�disable_network_activationF)r
�get_cfg_option_boolrW�local)r�rBs  r)�_should_bring_up_interfacesr�s)������*F�G�G���u��z�>�r*c��tjtjg}|jr
tjg}t	t
j�dtzd��|j���g}|jst|��}ntd|z��}tj||j���}|�
t|����d}d}	|�t jdf��t%j��t%j|j|��\}}n\#t,$rOd}t%jt0|��t3|��|�t j|f��YnwxYw|jr-t0�d��t!j��t!j|j��t=|j��t?||�	��|D] \}	}t0� |	|���!	|�!��n*#t,$rt%jt0d
��YnwxYw|j"}
tG|��|jrtj$ntj%}|tj%kr6d}tLj'�(dtSj*��z��n�d
}t%j+|jdd��}
|
rt0�d��d}nQ|
�,d��}t
j�-|��rt0�d|��d}|�.��t_||��}	|�0|���|tj%kr5|j1j2|kr%t0�d||j1��dgfSn�#tj3$r�|tj$krt0�d��nt%jt0d��|j4sN|�5|���t0�d|��|tj$krdgfcYSddgfcYSt0�d|��YnwxYwtm|��|�7��}t0�d||||�8����|tj$krts|dd���|�5|���|tj$kr[|j1j2|kr*t0�d||j1��|j1gfSt0�d ||j1��|�:��|�;��ts|d!d"���	|�<���=d#|j>t~gt~�$��\}}|s|�>t���n4#t,$r't%jt0d%��|j1d%gfcYSwxYwt
j�-|j"�,d&����rt�|jddd'�(��nt0�d)��t=|j��t�|t|��|j�*��}	|}|}t%jC|j|��\}}||ks||kr9t0�Dd+||��t%j|j|��\}}n*#t,$rt%jt0d,��YnwxYwt!j|j��|�E��t�|j1|j�-��|j1t�|||��fS).Nz%s.dz91_kernel_cmdline_url.cfg)r?r�z%s-local��ds_deps�reporterzClosing stdin.�#Failed to setup output redirection!�@Logging being reset, this logger may no longer be active shortlyr'z0Failed to initialize, likely bad things to come!�trustr�check�manual_cache_cleanFz"manual cache clean set from config�manual_clean_markerz(manual cache clean found from marker: %s��existingz)[%s] Exiting. datasource %s in local modezNo local datasource foundz8No instance datasource found! Likely bad things to come!)�bring_upz[%s] Exiting without datasourcezNo instance datasource found.z2[%s] barreling on in force mode without datasourcez5[%s] %s will now be targeting instance id: %s. new=%sr�r�)�stage�retry_stagez.[%s] Exiting. datasource %s not in local mode.z6[%s] %s is in local mode, will apply init modules now.zinit-netzmodules:config�consume_data)rB�freqzConsuming user data failed!�userdata_rawT)�config�strict�log_details�log_deprecationsz2Skipping user-data validation. No user-data found.�r�z#Stdout, stderr changing to (%s, %s)z'Failed to re-adjust output redirection!)�
datasourcerW)Hr
�DEP_FILESYSTEM�DEP_NETWORKr�r�r>r?r�rr-r�Initr��read_cfgrEr=rrrsr
�close_stdin�fixup_outputrW�	Exception�logexcr/r&rwrL�resetLogging�setupLoggingrXr1r�
initializer�r��DSMODE_LOCAL�DSMODE_NETWORKr"r#r$r�
debug_infor�r�rur�r��fetchr��dsmode�DataSourceNotFoundException�force�apply_network_config�_maybe_persist_instance_data�
instancify�is_new_instance�_maybe_set_hostname�setup_datasource�update�cloudify�runr�rrrr�get_output_cfgr��activate_datasource�di_report_warnrS)rArB�deps�
early_logs�w_msgr��outfmt�errfmtr(�lvl�path_helperror��mcfg�mfile�bring_up_interfaces�iid�ran�_resultsrF�outfmt_orig�errfmt_origs                      r)�	main_initr�#s>���"�G�$7�8�D��z�(��&�'��	�������%�'B����
�N�		
�	
�	
��J�,�:�4��t�$�$����z�T�2�3�3���;�t�d�m�<�<�<�D��M�M�+�d�#�#�$�$�$�
�F�
�F�/����7�=�*:�;�<�<�<�������,�T�X�t�<�<�������/�/�/�3����C������#�������7�<��-�.�.�.�.�.�	/����
�z���	�	�N�	
�	
�	
�	���������"�"�"����!�!�!�
�D�e����������S�����S�����M����������M�M�M���C�K�L�L�L�L�L�M�����*�K�(��.�.�.�#'�:�I�7���7�3I�D��w�%�%�%����
����7�#5�#7�#7�8�9�9�9�9����'���2F��N�N���	#��I�I�:�;�;�;��H�H��-�-�.C�D�D�E��w�~�~�e�$�$�
#��	�	�D�e�L�L�L�"��������6�d�D�A�A����
�
�H�
�%�%�%��7�)�)�)�d�o�.D��.L�.L��I�I�;����
�
�
�
�"�:�����.�����7�'�'�'��I�I�1�2�2�2�2��K��O�
�
�
��z�
	��%�%�/B�%�C�C�C��I�I�7��>�>�>��w�+�+�+��b�z�!�!�!��>�?�@�@�@�@��I�I�D�d�
�
�
�
�
�%����,!��&�&�&�
�/�/�
�
�C��I�I�?�������������w�#�#�#�	�D��Y�G�G�G�G����':��;�;�;��w�#�#�#��?�!�T�)�)��I�I�@����
�
�
�
�O�R�(�(��I�I�H����
�
�
�	�������K�K�M�M�M���J�<L�M�M�M�M�B��-�-�/�/�-�-�������	.�
�
���h��	*�
���j�)�)�)����B�B�B���C�6�7�7�7���"?�!@�A�A�A�A�B����

�w�~�~�d�j�.�.�~�>�>�?�?�H�#��8���!�		
�	
�	
�	
�	
�	�	�	�F�G�G�G����!�!�!��4��T�*�*�T�]�C�C�C�D�D������.�t�x��>�>�����&� � �K�6�$9�$9��K�K�=�v�v�N�N�N�#�0���4�@�@��V�V����D�D�D���C�B�C�C�C�C�C�D��������"�"�"�	�������d�o�4�8�<�<�<�<�
�O�/��d�D�A�A�B�Bsl�AD(�(AF�F�H/�/$I�I�AO"�"B R)�R)�R)�(R)�AX8�8.Y)�(Y)�A&]6�6$^�^c�J�d|vrt�d��dS|d}|�t�d��dSt|t��st�d|��dS|�d��}|�t�d��dSt|t��st�d|��dS|j�d��d	}|�	tj��r"|ttj��d�}nt�d
||��||vrt�d|||��dStjd||t|���
��dS)N�	di_reportzno di_report found in config.zdi_report was None.z%di_report config not a dictionary: %s�datasource_listz(no 'datasource_list' found in di_report.z(di_report/datasource_list not a list: %s�.rhz1Datasource '%s' came from unexpected module '%s'.z:used datasource '%s' from '%s' was in di_report's list: %s�dsid_missing_source)�source�dslist)r/rLrz�dictr�rU�list�
__module__�
rpartitionrtr
�	DS_PREFIXrKr�show_warningr�)r�rW�dicfgr��modnames     r)r�r�s����#����	�	�1�2�2�2������E��}�	�	�	�'�(�(�(����e�T�"�"�����;�U�C�C�C���
�Y�Y�(�
)�
)�F�
�~����>�?�?�?���
���
%�
%�����>��G�G�G����#�.�.�s�3�3�A�6�G����'�+�,�,�
��#�g�/�0�0�2�2�3������?���	
�	
�	
��&����	�	�H����		
�	
�	
�	�����s�7�3�v�;�;������r*c���|j}t|�d|����}tjg|j���}|�t
|����	|�d���nO#tj	$r=d|z}tjt|��t|��|js|gcYSYnwxYwt|��t!|t
|��|j���}	t�d��tj��tj|j|��n*#t*$rtjtd��YnwxYw|jr-t�d	��t-j��t-j|j��t3|j��t5||�
��t7|||��S)N�:r�r�r�zGCan not apply stage %s, no datasource found! Likely bad things to come!r��
Closing stdinr�r�r')ror-rr�r�r�rEr�r
r�r
r�r/r&r�r�rrLr�r�rWr�rrr�r�rXr1rS)rMrBrAr�r�r(rFs       r)�main_modulesr4s���9�D�
�k�k�k�4�4�8�9�9�E��;�r�D�M�:�:�:�D��M�M�+�d�#�#�$�$�$���
�
�G�
�$�$�$�$���.�	�	�	�
� $�
%�	�	
��C������#�����z�	��7�N�N�N�	�	�	����!��&�&�&��4��T�*�*�T�]�C�C�C�D�@��	�	�/�"�"�"��������$�(�D�)�)�)�)���@�@�@���C�>�?�?�?�?�?�@�����z���	�	�N�	
�	
�	
�	���������"�"�"����!�!�!��D�e������d�D�$�/�/�/s&�A1�1AB=�<B=�4AD<�<$E#�"E#c��|j}t|��}tjg|j���}|�t
|����	|�d���nH#tj	$r6tjtd��td��|jsYdSYnwxYwt|��t!|t
|��|j���}|j}|rt�d|��|j}|r5t�d|��t(�|��}	t�d	��tj��tj|jd��n*#t2$rtjtd
��YnwxYw|jr-t�d��t5j��t5j|j��t;|j��t=||���|�|||��\}}	|	rt� d
|��dS|st� d|��dSdS)Nr�r�r�z;Failed to fetch your datasource, likely bad things to come!rlr�zUsing passed in arguments %szUsing passed in frequency %sr�r�r�r'zRan %s but it failed!zDid not run %s, does it exist?r)!rAr-rr�r�r�rEr�r
r�r
r�r/r&r�r�r�module_argsrL�	frequency�FREQ_SHORT_NAMESrUr�r�rWr�rrr�r�rXr1�
run_singler�)
rArB�mod_namer�r�rF�mod_args�mod_freqrPrQs
          r)�main_singler	ks����y�H��4� � �E��;�r�D�M�:�:�:�D��M�M�+�d�#�#�$�$�$�
��
�
�G�
�$�$�$�$���.����	
���N�	
�	
�	
�	�I�	
�	
�	
��z�	��1�1�	�	�����!��&�&�&��4��T�*�*�T�]�C�C�C�D���H��<��	�	�0�(�;�;�;��~�H��2��	�	�0�(�;�;�;�#�'�'��1�1��@��	�	�/�"�"�"��������$�(�D�)�)�)�)���@�@�@���C�>�?�?�?�?�?�@�����z���	�	�N�	
�	
�	
�	���������"�"�"����!�!�!��D�e�����!�O�O�H�h��I�I��Y�������+�X�6�6�6��q�
�����4�h�?�?�?��q��qs%�A,�,?B1�0B1�
AF�$F9�8F9c���|�#t��}|�d��}|�tj�d��}tj�|d��}tj�|d��}tj�|d��}tj�|d��}t
j||f��|j\}	}
|dkr
|j	rd}n&d}n#|dkrd|j
z}ntd	|z���d
}||vr"td�|�����d}
|dkr||||fD]}t
j
|���n8	tjt
j|����}
n#t"$rYnwxYwgddd�}|
�d
ii}
d|
d
d<|D])}||
d
vr|���|
d
|<�*|
d
}||d<t'j��||d<t)j||
��t
jtj�||��|d���	|
||��}|dvr|\}}|�t1|��|d<n|}d�|D��||d<n]#t"$rP}t
jt4d|��t7d|z��t1|��g||d<Yd}~nd}~wwxYwt'j��||d<d|d<t)j||
��|dkr�g}|D]?}||dr/|�||�dg�����@t)j|d
|d|d�i��t
jtj�||��|d���t=||d��S)Nraz/run/cloud-initzstatus.jsonzresult.jsonr��
init-local�modules�
modules-%szunknown name: %s)r�rzmodules-initzmodules-config�
modules-finalz'Invalid cloud init mode specified '{0}')�errors�start�finished�v1r�r�rT)r�)r�rc�,�g|]}t|����Srp)r�)�.0r�s  r)�
<listcomp>z"status_wrapper.<locals>.<listcomp>s��5�5�5��c�!�f�f�5�5�5r*rzfailed stage %szfailed run of stage %srr)r�r)rr�r>r?�normpathr�r
�ensure_dirsr0r�ro�
ValueErrorr6�del_file�json�loads�	load_filer��copy�timer�
write_json�sym_link�relpathr�r�r/r&�extendrUrK)rArB�data_d�link_dr��status_path�status_link�result_path�result_link�_name�functorro�modes�status�f�
nullstatusr�r�retr�rr�s                      r)�status_wrapperr0�sm��
�~�� � ������(�(��
�~���!�!�"3�4�4���'�,�,�v�}�5�5�K��'�,�,�v�}�5�5�K��'�,�,�v�}�5�5�K��'�,�,�v�}�5�5�K�����	
�����{��U�G��v�~�~��:�	��D�D��D�D�	
��	�	��d�i�'����+�d�2�3�3�3�
�E��5����5�<�<�T�B�B�
�
�	
��F��|����{�K��E�	�	�A��M�!�����	�	��Z���{� ;� ;�<�<�F�F���	�	�	��D�	���������J��~�����%)��t��\�"�
�0�0���F�4�L� � �(�o�o�/�/�F�4�L��O��	���B��B�w�K��	���B�t�H�W����[�&�1�1�1��M�
�����V�,�,�k������&��g�d�D�!�!���)�)�)�#&� �Z���%�#&�z�?�?��<� ���F�5�5�f�5�5�5��4�������&�&�&���C�*�D�1�1�1��*�T�1�2�2�2�!�!�f�f�X��4�������������&����
 �9�;�;�B�t�H�Z���B�w�K���[�&�1�1�1��������	7�	7�A��!�u�X��
7��
�
�b��e�i�i��"�5�5�6�6�6��� ��
�"�\�"2�f�E�E�F�	
�	
�	
�	
�
��G�O�O�K��0�0�+�T�	
�	
�	
�	
��r�$�x��!�"�"�"s,�,&F�
F �F �AJ�
K6�&AK1�1K6r�c���|jr]|jrX|j�d��}tj�|��s!|j�d���dSdSdSdS)zCWrite instance-data.json file if absent and datasource is restored.�
instance_dataF)�write_cacheN)r��ds_restoredr��get_runpathr>r?ru�persist_instance_data)r��instance_data_files  r)r�r�%s�����E�4�+�E�!�Z�3�3�O�D�D���w�~�~�0�1�1�	E��O�1�1�e�1�D�D�D�D�D�E�E�E�E�	E�	Er*c	�J�|���}tj|j|d���\}}}|rl	t	jd|j|td��dS#tj$r5}t�d||t|����Yd}~dSd}~wwxYwdS)z�Call set-hostname if metadata, vendordata or userdata provides it.

    @param stage: String representing current stage in which we are running.
    @param retry_stage: String represented logs upon error setting hostname.
    T)�
metadata_onlyzset-hostnameNzGFailed setting hostname in %s stage. Will retry in %s stage. Error: %s.)
r�r
�get_hostname_fqdnrWr�handler/�SetHostnameErrorrLr�)r�r�r��cloud�hostname�_fqdn�_r�s        r)r�r�-s���
�M�M�O�O�E��1���%�t�����X�u�a��
�		��"�>�4�8�U�C��N�N�N�N�N���/�	�	�	��I�I�1����A���
�
�
�
�
�
�
�
�
�����	����
�
s�"A�B �+*B�B c��tj�d�t	t
j����dz��dS)Nr )r"�stdoutr$r��sortedr�FEATURES)rArBs  r)�
main_featuresrEDs:���J���T�Y�Y�v�g�&6�7�7�8�8�4�?�@�@�@�@�@r*c
��|stj}tj|�d�����}|�ddddt
j��zd���|�d	d
ddd
tjd�����|�ddddd���|�ddddd���|�	d���|�
dd���}d|_|�dd �!��}|�d"d#dd$d���|�	dtf�%��|�d&d'�!��}|�d(d)d*d+d,d-�.��|�	d&tf�%��|�d/d0�!��}|�d1d2d*d3d�4��|�d5d*d6dtt ������7��|�d8dd9d�4��|�d:d;d<d=�>��|�	d/t$f�%��|�d?d@�!��}|�t&jt&j�!��}t'j|��|�dAdB�!��}|�	dAt.f�%��|�dCdD�!��}	|�dEdF�!��}
|�dGdH�!��}|�dIdJ�!��}|�dKdL�!��}
|�dMdN�!��}|�r2|d}|dCkrddOlm}||	���n|dEkrddOlm}||
��n�|dGkr,ddPlm}m}||��|�	dG|f�%��n�|dIkr,ddQlm}m}||��|�	dI|f�%��n�|d?kr,ddRlm}m}||��|�	dS|f�%��nc|dMkr,ddTl m}m!}||��|�	dM|f�%��n1|dKkr+ddUl"m}m#}||
��|
�	dK|f�%��|�$|�V��}|j%\}}|j&rtOj(��tSj*��|dWvrtV}d}d} |dkr|j,rdX\}}!nLdY\}}!nF|d&krdZ|j-zd[|j-z}!}n+|d/krd\|j.zd]|j.z}!}|j/} n	|}d^|z}!d} taj1||!| �_��|_2|j25tgj4tjj&d`|zd|||f�a��}"ddd��n#1swxYwYtmj7��|"S)bNr)�progz	--versionz-vrz	%(prog)s z'Show program's version number and exit.)r0r�helpz--filez-fr=r<z(Use additional yaml configuration files.�rb)r0�destrH�typez--debugz-d�
store_truez:Show additional pre-action logging (default: %(default)s).F)r0rH�defaultz--forcezDForce running even if no datasource is found (use at your own risk).r�)r0rHrJrMr��Subcommands�
subcommand)�titlerJTr�z2Initialize cloud-init and perform initial modules.)rHz--localz-lz+Start in local mode (default: %(default)s).r9rz1Activate modules using a given configuration key.z--modez-m�storez8Module configuration name to use (default: %(default)s).r�)r�r��final)r0rHrM�choices�singlezRun a single module.z--namez-nzModule name to run.)r0rH�requiredz--frequencyzModule frequency for this run.)r0rHrUrSz--reportzEnable reporting.r�*�argumentz0Any additional arguments to pass to this module.)�nargs�metavarrH�queryz;Query standardized instance metadata from the command line.�featureszList defined features.�analyzez-Devel tool: Analyze cloud-init logs and data.�develzRun development tools.zcollect-logsz*Collect and tar all cloud-init debug info.�cleanz3Remove logs and artifacts so cloud-init can re-run.r,z/Report cloud-init status or wait on completion.�schemaz-Validate cloud-config files using jsonschema.)�
get_parser)r`�handle_collect_logs_args)r`�handle_clean_args)r`�handle_args�render)r`�handle_schema_args)r`�handle_status_args)rB)rr�)rzsearching for local datasources)zinit-networkz!searching for network datasourcesr
zrunning modules for %sz	single/%szrunning single module %szrunning 'cloud-init %s')�reporting_enabledzcloud-init mode '%s')�logfuncr(�
get_uptime�funcrB)8r"�argv�argparse�ArgumentParser�pop�add_argumentrr7�FileType�set_defaults�add_subparsersrU�
add_parserr�rr�r�keysr	r�NAME�__doc__r`rE�cloudinit.analyze.__main__�cloudinit.cmd.devel.parser�cloudinit.cmd.devel.logsra�cloudinit.cmd.cleanrb�cloudinit.cmd.queryrc�cloudinit.config.schemare�cloudinit.cmd.statusrf�
parse_argsr0rLrr�setupBasicLoggingr	�attach_handlersr0r�rorA�reportr�ReportEventStackr�r
�log_timer/r�flush_events)#�	sysv_args�parser�
subparsers�parser_init�
parser_mod�
parser_single�parser_query�parser_dhclient�parser_features�parser_analyze�parser_devel�parser_collect_logs�parser_clean�
parser_status�
parser_schemarO�analyze_parser�devel_parser�logs_parserra�clean_parserrb�query_parser�handle_query_args�
schema_parserre�
status_parserrfrBrAr*�rname�	report_on�rdesc�retvals#                                   r)�mainr�Hs������H�	�
�
$�)�-�-��*:�*:�
;�
;�
;�F��������w�5�7�7�8�
6�����������
�
7�
�
�t�
$�
$�
����������
I�����������
-����	�	�	������&�&�&��&�&�]��&�N�N�J��J���'�'��I�(���K�������
:���������V�Y�$7��8�8�8��&�&��K�'���J�������
G��+�
�������I�|�#<��=�=�=��)�)��-�*���M�������
"�����������
-���%�*�*�,�,�-�-����������
 ��	����������
?�	�������x��&=��>�>�>��(�(��
J�)���L�
!�+�+����!6�,���O���_�-�-�-� �+�+��1�,���O�� � ��]�(C� �D�D�D��*�*��G�+���N��(�(��.�)���L�%�/�/��I�0�����(�(��K�)���L��)�)��H�*���M��)�)��F�*���M��6N��q�\�
���"�"�O�O�O�O�O�O�
�N�>�*�*�*�*�
�7�
"�
"�M�M�M�M�M�M�
�L��&�&�&�&�
�>�
)�
)�
�
�
�
�
�
�
�
�

�K�+�,�,�,��,�,�&�(@�A�
-�
�
�
�
��7�
"�
"�
�
�
�
�
�
�
�
�

�L��&�&�&��%�%�g�7H�-I�%�J�J�J�J�
�7�
"�
"�
�
�
�
�
�
�
�
�

�L��&�&�&��%�%�h�8I�-J�%�K�K�K�K�
�8�
#�
#�
�
�
�
�
�
�
�
�

�M�-�(�(�(��&�&�x�9K�.L�&�M�M�M�M�
�8�
#�
#�
�
�
�
�
�
�
�
�

�M�-�(�(�(��&�&�x�9K�.L�&�M�M�M����)��,�,�D��k�O�T�7��z�$��!�#�#�#��"�$�$�$��"�"�"� ���E��I��v�~�~��:�	�L�L�E�5�5��L�E�5�5�
��	�	��4�9�$�$�t�y�0����
��	�	��$�)�#�&���2����K�	�	���)�D�0���	��+�
�u�	����D�M�
��
�
����I�&��-������
�
�
��
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�������Ms�<)V1�1V5�8V5�__main__�TZz:/etc/localtime)rr;)rY)TN)NN)Grlrr>r"rr%�typingr�	cloudinitr�cloudinit.config.modulesr�
patch_loggingr|rrrrrr	r
rrr
rrr�cloudinit.reportingr�cloudinit.settingsrrrrr�cloudinit.configrr�cloudinit.cmd.develrr5rIr�	getLoggerr/r&r1r-rErSrXrc�intr�r�r�r�r�r�rr	r0r�r�r�rEr��__name__�environrk�return_value�exitrpr*r)�<module>r�s��$��������	�	�	�	�
�
�
�
���������������������,�,�,�,�,�,�������?�?�?�?�?�?�$�$�$�$�$�$�������$�$�$�$�$�$������������� � � � � � �������������������������&�&�&�&�&�&�O�O�O�O�O�O�O�O�O�O�O�O�#�#�#�#�#�#�,�,�,�,�,�,�#�#�#�#�#�#�.�.�.�.�.�.�
(��%��
�������g�����
�����������
�
�
��W�����&=�=�=�
K�K�K�K�i�i�U�3��8�_�i�i�i�i�XE�E�E�<���\C�\C�\C�~/�/�/�d40�40�40�nD�D�D�Np#�p#�p#�p#�fE�v�{�E�E�E�E����.A�A�A�~�~�~�~�B�z����2�:���,��
�4���4���>�>�L���������������r*