%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/lib/python3/dist-packages/cloudinit/cmd/__pycache__/
Upload File :
Create Path :
Current File : //proc/self/root/lib/python3/dist-packages/cloudinit/cmd/__pycache__/main.cpython-312.pyc

�

���ft����ddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZddl
mZddl
m
Z
ddl
mZddl
mZddl
mZdd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddl
mZddlmZddlmZddlmZddlmZddl
mZddl m!Z!ddl"m#Z#m$Z$m%Z%m&Z&dZ'dZ(e#e$e%d�Z)ddddd�Z*ejVe,�Z-d=d�Z.dZ/d �Z0d>d!�Z1d"�Z2e-jffd#e	e4gdffd$�Z5d%�Z6d&efd'�Z7d(�Z8d?d)�Z9d@d*ee:e4ffd+�Z;d,�Z<d-�Z=d.�Z>d/�Z?d0�Z@d1�ZAd2�ZBd3ej�fd4�ZDd5�ZEd6�ZFd>d7�ZGd8�ZHd9�ZIe,d:k(rEd;ej�vrd<ej�d;<eGej��ZLeLrej�eL�yyy)A�N)�Tuple�Callable)�netinfo)�signal_handler)�sources)�socket)�stages)�
url_helper)�util)�version)�warnings)�	reporting)�
atomic_helper)�	lifecycle)�read_cfg_paths)�cc_set_hostname)�Modules)�validate_cloudconfig_schema)�log)�events)�PER_INSTANCE�
PER_ALWAYS�PER_ONCE�CLOUD_CONFIGzOCloud-init v. {version} running '{action}' at {timestamp}. Up {uptime} seconds.zcloud_%s_modules)�instance�always�oncezLocal Stagez
Network StagezConfig StagezFinal Stage)�
init-local�init�modules-config�
modules-finalc��|r"tjjd|z�tjjd�tjjd�tjtj��tjjd�tjjd�y)N�%s
z<------------------------------------------------------------�
)�file)�sys�stderr�write�	traceback�	print_exc��msgs �4/usr/lib/python3/dist-packages/cloudinit/cmd/main.pyr*r*Osu��
��
�
����3��(��J�J���X���J�J���T��
���S�Z�Z�(��J�J���X���J�J���T��a�Triggering cloud-init boot stages outside of intial system boot is not a fully supported operation which can lead to incomplete or incorrect configuration. As such, cloud-init is deprecating this feature in the future. If you currently use cloud-init in this way, please file an issue describing in detail your use case so that cloud-init can better support your needs: https://github.com/canonical/cloud-init/issues/newc���|jrItj�}d|k7r0|j�r t	j
d|�d�dt��tjd|�y)N�z5Unsupported configuration: boot stage called by PID [z] outside of systemdz24.3��
deprecated�deprecated_version�
extra_messagez!PID [%s] started cloud-init '%s'.)	�is_linux�os�getppid�uses_systemdr�	deprecate�DEPRECATE_BOOT_STAGE_MESSAGE�LOG�info)�distro�bootstage_name�ppids   r-�log_ppidr@dsa��
����z�z�|����9��,�,�.�����#�f�$8�:�$*�:�

��H�H�
0�$��Gr.c�`�|st|�}tjd|zddt��|S)Nr#FT)�consoler'r)�welcome_formatr�	multi_logr;)�actionr,s  r-�welcomerFss*����V�$���N�N�6�S�>�5��3�G��Jr.c��tjtj�t	j
�t	j�|��S)N)r�uptime�	timestamprE)�WELCOME_MSG_TPL�formatr�version_stringrrH�time_rfc2822�rEs r-rCrCzs>���!�!��&�&�(��{�{�}��#�#�%��	"��r.�loggerc�d�tjtjj	��sk|d�ttj�5}tj|j	�tjj	��ddd�y|d�y#1swYyxYw)zj
    reopen stdin as /dev/null to ensure no side effects

    logger: a function for logging messages
    z
Closing stdinNz"Not closing stdin, stdin is a tty.)r6�isattyr&�stdin�fileno�open�devnull�dup2)rO�fps  r-�close_stdinrX�sy���9�9�S�Y�Y�%�%�'�(����
�"�*�*�
�	5���G�G�B�I�I�K����!1�!1�!3�4�	5�	5�	�3�4�	5�	5�s
�AB&�&B/c��g}|jrI|jD]:}|jtjj	|j
���<|S�N)�files�appendr6�path�realpath�name)�args�fn_cfgs�fhs   r-�extract_fnsrc�sK���G��z�z��*�*�	6�B�
�N�N�2�7�7�+�+�B�G�G�4�5�	6��Nr.�modsc�N�t|z}|j|�\}}t|�t|�z}|dk(rBd|�d|�d�}tjjd|z�tj|�gStjdt|�t|��|S)NrzNo 'z ' modules to run under section '�'r#zRan %s modules with %s failures)�MOD_SECTION_TPL�run_section�lenr&r'r(r;�debug)rd�action_name�section�full_section_name�	which_ran�failures�total_attemptedr,s        r-�run_module_sectionrq�s���'�7�3�� �,�,�->�?��Y���)�n�s�8�}�4�O��!����
��	�
�
����3��(��	�	�#���	��	�	�-�s�9�~�s�8�}�	
��r.c�p�|jd�r%tj|jd��yy)Nr)�getr�update_configuration)�cfgs r-�apply_reporting_cfgrv�s*��
�w�w�{���&�&�s�w�w�{�';�<�r.c�x�tj|�}|D]}||vs�|||fcStd|�d|�d���)Nz	No keys (z) found in string 'rf)r�keyval_str_to_dict�KeyError)�cmdline�names�data�keys    r-�parse_cmdline_urlr~�sH���"�"�7�+�D��"���$�;���S�	�>�!�"��'�5�I�
J�Jr.�returnc��|�tj�}	t|�\}}|j
d�}|rmtjj|�rN|r/d|�d|�d�}tj}|rtj
}||fSd|�d|�d�}tj}||fS|dd	d
d�}|s|rtj}d|d
<ntj
}d|d
<d}	d}
	tjd%i|��}d}|j�r�d
}
t|tj �r<	|t#|j%t'|
����z
}|j
|
�s d}
n|j*j
|
�sd}
|
r|dk(rgt-j.dddd
��S|dk(rtj}ntj}|d|�dt1|
���fS|d|�d|j2�d�fS||j*z}	tj6||	d �!�tjd"|�d#|�d$|��fS#t$rtj
dfcYSwxYw#t($rY��wxYw#tj4$r}|d|�d|��fcYd}~Sd}~wwxYw)&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)�url�timeout�retries�streamr0�sec_betweeng�������?s
#cloud-configr.)�
chunk_sizeFr�z!The kernel command line key `url`z22.3zD Please use `cloud-config-url` kernel command line parameter instead�r2r3r4�skip_log�cloud-config-urlz
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_cmdliner~ry�logging�DEBUG�
startswithr6r]�exists�INFO�WARNr
�read_file_or_url�ok�
isinstance�UrlResponse�next�iter_contentri�
StopIteration�contentsrr9�str�code�UrlError�
write_file)r]�networkrz�cmdline_namer��
path_is_local�m�level�kwargsr|�header�resp�sniffed_content�is_cloud_cfg�es               r-�attempt_cmdline_urlr��s���&���"�"�$��D�-�g�6���c��N�N�#3�4�M��������-��AE�c�K�
��L�L�E���
�
���q�z���AE�c�K�
��L�L�E��q�z���R�A��
F�F��-����� !��}���
�
�� #��}���D�
�F�*D��*�*�4�V�4�����7�7�9��L��$�
� 6� 6�7��#�t��)�)�S��[�)�A�(��O�
'�1�1�&�9�#(�L��]�]�-�-�f�5�$����5�(�$�.�.�#F�+1�'@�!%��� �#5�5�#�L�L�E�#�L�L�E��#�C�5�(=�c�&�k�]�K����:=�t�y�y�I��
�����.��
	�O�O�D�$�U�+������d�	$����]�D��
�
�B�C�C�D��V%�����>���D��3��B�C�C��D�sg�H-�!AI�%'I�AI�8I�I�+I�-I�
I�	I�I�I�I�J�1	J�:J�Jc��dtjjtjjfz}tj
j
|jjd�d�}tj
j|�r\t|�j�}||k7r=tjd�|jd�tj ||�yytj
j|jj#d��rtj%d�tj ||�y)	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.%dr|zpython-versionz-Python version change detected. Purging cacheT�obj_pklzMWriting python-version file. Cache compatibility status is currently unknown.N)r&�version_info�major�minorr6r]�join�paths�	get_cpathr�rT�readr;rj�purge_cacherr��
get_ipath_curr<)r�current_python_version�python_version_path�cached_python_versions    r-�$purge_cache_on_python_version_changer�+s��%�����������(����'�'�,�,��
�
���V�$�&6���
�w�w�~�~�)�*� $�%8� 9� >� >� @��!�$:�:��I�I�E�F����T�"��O�O�/�1G�H�;�
�7�7�>�>�$�*�*�2�2�9�=�>��H�H�C�
�	
���+�-C�Dr.c�^�tj|jd�ry|jS)N�disable_network_activationF)r�get_cfg_option_boolru�local)rr`s  r-�_should_bring_up_interfacesr�Is&��������*F�G���z�z�>�r.c����tjtjg}|jrtjg}t	t
jjdtzd�|j��g�|jrdnd}t|�}tj||j��}|jt|��d}d}	|js2t!�fd��t#j$|j&|�\}}n#t#j(|j&|�\}}|j8r)t.j9d	�t;j<�|js4t;j>|j&�tA|j&�tC||�
�tE|jF|��D]\}	}t.j;|	|��	|jI�|jJ}
tM|�|jrtjNntjP}|tjPk(r7d}tRjTjWd
tYjZ�z�n�d}t#j\|j&dd�}
|
rt.j9d�d}nH|
j_d�}t
jja|�rt.j9d|�d}|jc�te||�}	|jg|��|tjPk(r>|jhjj|k7r%t.j9d||jh�dgfSts|�|ju�}t.j9d||||jw��|tjNk(rty|dd��|jq|��|tjNk(ri|jhjj|k7r/t.j9d ||jh�|jhgfSt.j9d!||jh�|j{�|j}�ty|d"d#��	|j�j�d$|j�t�gt��%�\}}|s|j�t��|jJj_d'�}t
jja|�rXtj�|�j�d(k7r6t�t�j�t#j�|��ddd)�*�nt.j9d+�tA|j&�t�|t|�|j�,�}	|}|}t#j(|j&|�\}}||k7s||k7r:t.j�d-||�t#j$|j&|�\}}t;j>|j&�|j��t�|jh|j&�/�|jht�|||�fS#t*$rLd}t#j,t.|�t1|��j3t4j6|f�Y���wxYw#t*$rt#j,t.d�Y��2wxYw#tjl$r�|tjNk(rt.j9d�nt#j,t.d�|jnsH|jq|��t.j9d|�|tjNk(rdgfcYSddgfcYSt.j9d|�Y��gwxYw#t*$r,t#j,t.d&�|jhd&gfcYSwxYw#t*$rt#j,t.d.�Y��wxYw)0Nz%s.dz91_kernel_cmdline_url.cfg)r]r�rr��ds_deps�reporterc�F���jtj|f�SrZ)r\r�r�)r,�
early_logss �r-�<lambda>zmain_init.<locals>.<lambda>ts���J�$5�$5�w�}�}�c�6J�$K�r.�#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)r`�freqzConsuming user data failed!�cloud_configrT)�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!)�
datasourceru)Or�DEP_FILESYSTEM�DEP_NETWORKr�r�r6r]r�rrCr	�Initr��read_cfgrc�skip_log_setuprXr�fixup_outputru�get_output_cfg�	Exception�logexcr;r*r\r�r�rjr�
reset_logging�
setup_loggingrvrFr@r=�
initializer�r��DSMODE_LOCAL�DSMODE_NETWORKr&r'r(r�
debug_infor�r�r�r�r��fetchr��dsmode�DataSourceNotFoundException�force�apply_network_config�_maybe_persist_instance_data�
instancify�is_new_instance�_maybe_set_hostname�setup_datasource�update�cloudify�runr�rr�stat�st_sizer�yaml�	safe_load�load_text_filer�warning�activate_datasource�di_report_warnrq)r_r`�depsr>�w_msgr�outfmt�errfmtr,�lvl�path_helperr�r��mcfg�mfile�bring_up_interfaces�iid�ran�_results�cloud_cfg_pathrd�outfmt_orig�errfmt_origr�s                       @r-�	main_initrOs�����"�"�G�$7�$7�8�D��z�z��&�&�'��	��������%�'B���
�
�N�		
��J�,&*�Z�Z�\�V�N��>�*�E��;�;�t�d�m�m�<�D��M�M�+�d�#�$�
�F�
�F�
/��"�"��K�L�!�.�.�t�x�x��>�N�F�F�!�0�0����4�@�N�F�F��z�z��	�	�N�	
�	����������$�(�(�#��D�H�H�%�
�D�e���T�[�[�.�)�����S�����S���M������*�*�K�(��.�#'�:�:�7���7�3I�3I�D��w�%�%�%����
�
����7�#5�#5�#7�8�9����'�'����2F��N����I�I�:�;��H��-�-�.C�D�E��w�w�~�~�e�$��	�	�D�e�L�"������6�d�D�A����
�
�H�
�%��7�)�)�)�d�o�o�.D�.D��.L��I�I�;�����
�
�"�:��.!��&�
�/�/�
�C��I�I�?����������w�#�#�#�	�D��Y�G����':��;��w�#�#�#��?�?�!�!�T�)��I�I�@�����
�
�O�O�R�(�(��I�I�H�����
�	�����K�K�M���J�<L�M�B��-�-�/�-�-��������	.�
���h��
���j�)��Z�Z�-�-�n�=�N�	�w�w�~�~�n�%�"�'�'�.�*A�*I�*I�Q�*N�#��>�>�$�"5�"5�n�"E�F���!�		
�	�	�	�F�G�����!��4��T�*�T�]�]�C�D�D������.�.�t�x�x��>�����&� �K�6�$9��K�K�=�v�v�N�#�0�0����4�@��V�V����d�h�h��	�����d�o�o�4�8�8�<�
�O�O�/��d�D�A�B�B��m�/�3�����C����#�����7�<�<��-�.�	/��8�M����C�K�L�M��J�.�.���7�'�'�'��I�I�1�2��K�K��O�
��z�z��%�%�/B�%�C��I�I�7��>��w�+�+�+��b�z�!��>�?�@�@��I�I�D�d�
�%��^�B����C�6�7����"?�!@�A�A�B��8�D����C�B�C�D�sl�A!Z6�2\�1A"\8�4A_?�"A+`7�6A\�
\�#\5�4\5�8B!_<�_<�"_<�;_<�?2`4�3`4�7#a�ac��d|vrtjd�y|d}|�tjd�yt|t�stj	d|�y|jd�}|�tj	d�yt|t�stj	d|�y|jjd�d	}|jtj�r|ttj�d}ntj	d
||�||vrtjd|||�ytjd||t|��
�y)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�.r�z1Datasource '%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;rjr��dictr�rs�list�
__module__�
rpartitionr�r�	DS_PREFIXrir
�show_warningr�)r�ru�dicfgr�modnames     r-rr1s7���#���	�	�1�2�����E��}�	�	�	�'�(���e�T�"����;�U�C��
�Y�Y�(�
)�F�
�~����>�?��
���
%����>��G���#�#�.�.�s�3�A�6�G����'�+�+�,��#�g�/�/�0�2�3�����?���	
��&���	�	�H����		
�	�����s�7�3�v�;�r.c�"�|j}|�d|��}t|�}tjg|j��}|jt
|��	|jd��t|�t!|t
|�|j��}	|j"s*t%�tj&|j(|�|j,r)tj-d�t/j0�|j"s4t/j2|j(�t5|j(�t7||�	�t9|j:|�|d
k(rt=j>ddd
��tA|||�S#tj$r?d|z}tjt|�t|�|js|gcYSY��vwxYw#t*$rtjtd�Y��=wxYw)N�:r�r�r�zGCan not apply stage %s, no datasource found! Likely bad things to come!r�r�r�r+rz
`--mode init`�24.1�Use `cloud-init init` instead.r1)!r�rCr	r�r�r�rcr�rr�rr�r;r*r�r�rr�rXr�rur�rjrr�r�rvrFr@r=rr9rq)rkr`r_r>rrr,rds        r-�main_modulesr$cs����9�9�D�!,�T�2�N��>�*�E��;�;�r�D�M�M�:�D��M�M�+�d�#�$���
�
�G�
�$�!��&��4��T�*�T�]�]�C�D�@��"�"��M����d�h�h��-��z�z��	�	�N�	
�	����������$�(�(�#��D�H�H�%��D�e���T�[�[�.�)��v�~����&�%�:�	
��d�D�$�/�/��U�.�.�	�
� $�
%�	�	
���C����#���z�z��7�N��	��$�@����C�>�?�@�s%�F�6G'�AG$�#G$�'#H�
Hc��|j}t|�}tjg|j��}|jt
|��	|jd��t|�t!|t
|�|j��}|j"}|rtj%d|�|j&}|r+tj%d|�t(j+|�}	t-�tj.|j0d�|j$r)tj%d
�t5j6�t5j8|j0�t;|j0�t=||��|j?|||�\}}	|	rtjAd|�y|stjAd
|�yy#tj$r7tjtd�td�|jsYyY���wxYw#t2$rtjtd	�Y��2wxYw)Nr�r�r�z;Failed to fetch your datasource, likely bad things to come!r0r�zUsing passed in arguments %szUsing passed in frequency %sr�r�r+zRan %s but it failed!zDid not run %s, does it exist?r)!r_rCr	r�r�r�rcr�rr�rr�r;r*r�r�r�module_argsrj�	frequency�FREQ_SHORT_NAMESrsrXr�rur�rr�r�rvrF�
run_singler�)
r_r`�mod_namerrrd�mod_args�mod_freqrnros
          r-�main_singler-�s����y�y�H��4� �E��;�;�r�D�M�M�:�D��M�M�+�d�#�$�
��
�
�G�
�$�!��&��4��T�*�T�]�]�C�D����H���	�	�0�(�;��~�~�H���	�	�0�(�;�#�'�'��1��@��
����$�(�(�D�)��z�z��	�	�N�	
�	�������d�h�h������!��D�e��!�O�O�H�h��I��Y������+�X�6��
����4�h�?����e�.�.��	
����N�	
�	�I�	
��z�z�����4�@����C�>�?�@�s%�G�0*H&�AH#�"H#�&#I
�I
c
��t�}|jd�}tjj	|j
�}tjj
|d�}tjj
|d�}tjj
|d�}tjj
|d�}tj�}	tj||f�|j\}
}|dk(r|jrd}n&d}n#|dk(rd|jz}ntd|z��|tvrtd	j!|���giddd
�}
dd|
j#�|
j#�|
j#�|
j#�d�i}|dk(r!||||fD]}tj$|��n)	t'j(tj*|��}||dvr|
j#�|d|<|d}||d
<||dr%||dst.j1dt|�t3tj4��||d<t7t9d�|	j:��}|j=�}t?j@||�tjBtjjE||�|d��	|||�}|dvr|\}}|�tG|�|d<n|}||djI|D�cgc]
}tG|���c}�t3tj4��||d<d|d
<|j=�}|jU�|jW�D];}||vr'tYt[||||z��||d|<�.||||d|<�=t?j@||�|dk(r�g}|jW�D]O}t]||t^�s�||jad�s�,|jI||jadg���Qt?j@|d|d|d�i�tjBtjjE||�|d��tc||d�S#t,$rY���wxYwcc}w#t,$rO}t.jKd|�tMd|z�||djOtG|��Yd}~���d}~wtP$ri}|jRrRt.jKd|�tMd|z�||djOdtG|jR��d��Yd}~��Rd}~wwxYw#t3tj4��||d<d|d
<|j=�}|jU�|jW�D];}||vr'tYt[||||z��||d|<�.||||d|<�=t?j@||�wxYw)Nr|zstatus.jsonzresult.jsonrr�modules�
modules-%szunknown name: %sz'Invalid cloud init mode specified '{0}')�errors�recoverable_errors�start�finished�v1)r�rrr r!r�r3r4z=Unexpected start time found for %s. Was this stage restarted?c�6�t|tj�SrZ)r�r�LogExporter)�hs r-r�z status_wrapper.<locals>.<lambda>4s���A�s���7�r.T)r�)rrr�r1zfailed stage %szfailed run of stage %sz	sys.exit(z) calledr2r!)r�r1)2rr�r6r]�normpath�run_dirr�r��	getLoggerr�ensure_dirsrEr�r��
ValueError�
STAGE_NAMErK�copy�del_file�json�loadsr�r�r;r��floatrHr��filter�handlers�export_logsr�
write_json�sym_link�relpathr��extend�	exceptionr*r\�
SystemExitr��
clean_logs�keysr�setr�rrsri)r_r`r��data_d�link_d�status_path�status_link�result_path�result_link�root_logger�_name�functorr��
nullstatus�status�fr5�handler�preexisting_recoverable_errors�retr�r1r��new_recoverable_errorsr}r�s                          r-�status_wrapperr`�s����E�
�_�_�V�
$�F�
�W�W�
�
�e�m�m�
,�F��'�'�,�,�v�}�5�K��'�'�,�,�v�}�5�K��'�'�,�,�v�}�5�K��'�'�,�,�v�}�5�K��#�#�%�K������	
���{�{��U�G��v�~��:�:��D��D�	
��	��d�i�i�'���+�d�2�3�3��:���5�<�<�T�B�
�	
�
� ���	�J�	
���O�O�%�$�/�/�+�(�o�o�/�'�_�_�.�
��F��|���{�K��E�	�A��M�M�!��	�	��Z�Z�� 3� 3�K� @�A�F��6�$�<��'�_�_�.��t��T��	���B��B�w�K�	�$�x����D��*�!5����K��t��	
�
�d�k�k�m�,�B�t�H�W����7��9M�9M�N��G�&-�%8�%8�%:�"����[�&�1��M�M�
������V�,�k���16��d�D�!���)�)�#&� �Z���%�#&�z�?��<� ��F�
�4����!�!�6�":�a�3�q�6�":�;�( %�T�[�[�]�3��4������7��")�!4�!4�!6������)�.�.�0�	�C��4�4�6:��6�s�;�0��5�6��7��4��-�.�s�3�7M��7��4��-�.�s�3�	�	� � ��f�5����������	7�A��"�Q�%��&�2�a�5�9�9�X�+>��
�
�b��e�i�i��"�5�6�	7�	� � ��
�"�\�"2�f�E�F�	
�	
�
�
��G�G�O�O�K��0�+�T�	
��r�$�x��!�"�"��}�	��	��J#;���*��
�
�'��.��*�T�1�2�
�4����!�!�#�a�&�)�)���	I�
�6�6�
�M�M�+�T�2��.��5�6��t�H�X��%�%�	�#�a�f�f�+��h�&G�H���	I�� %�T�[�[�]�3��4������7��")�!4�!4�!6������)�.�.�0�	�C��4�4�6:��6�s�;�0��5�6��7��4��-�.�s�3�7M��7��4��-�.�s�3�	�	� � ��f�5�sc�(R4�':S	�!S�3S	�4	S�S�S	�		V�AT�V�V�(AV�V�V�V�B.Yrc���|jre|jrX|jjd�}tj
j
|�s|jjd��yyyy)zCWrite instance-data.json file if absent and datasource is restored.�
instance_dataF)�write_cacheN)r��ds_restoredr��get_runpathr6r]r��persist_instance_data)r�instance_data_files  r-r�r��sX�����4�+�+�!�Z�Z�3�3�O�D���w�w�~�~�0�1��O�O�1�1�e�1�D�2�,�r.c	�>�|j�}tj|j|d��\}}}|r$	t	j
d|j|d�yy#tj$r+}tjd||t|��Yd}~yd}~wwxYw)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_only�set_hostnameNzGFailed setting hostname in %s stage. Will retry in %s stage. Error: %s.)
r�r�get_hostname_fqdnrur�handle�SetHostnameErrorr;rjr�)rr�r��cloud�hostname�_fqdn�_r�s        r-r�r��s���
�M�M�O�E��1�1����%�t���X�u�a��		��"�"�>�4�8�8�U�D�I����/�/�	��I�I�1����A��
�
��	�s�"A�B�1!B�Bc��tjjdjt	t
j��dz�y)Nr$)r&�stdoutr(r��sortedr�FEATURES)r_r`s  r-�
main_featuresrv�s-���J�J���T�Y�Y�v�g�&6�&6�7�8�4�?�@r.c
�h	�tj�|stj}t	j
|j
d���}|jddddtj�zd��|jd	d
ddd
��|jddddd
��|jddddd
��|jd��|jdd��}|jdd��}|jdddd d
��|jd!d"d#d$d%t	jd&��'�|jdtf�(�|jd)d*��}tj d+d,d-d.�/�j"}|jd0d1d2d3|��d4d5�6�|jd!d"d#d$d%t	jd&��'�|jd)t$f�(�|jd7d8��}|jd9d:d2d;d.�<�|jd=d2d>d
t't(j+���?�|jd@ddAd
�<�|jdBdCdDdE�F�|jd!d"d#d$d%t	jd&��'�|jd7t,f�(�|jdGdH��}|jdIdJ��}|jdIt.f�(�|jdKdL��}	|jdMdN��}
|jdOdP��}|jdQdR��}|jdSdT��}
|jdUdV��}|�rt1dW�|D�d�}|dKk(rddXlm}||	�n�|dMk(rddXlm}||
�n�|dOk(r&ddYlm}m}||�Z�|jdO|f�(�n�|dQk(r%dd[lm}m}||�|jdQ|f�(�n�|dGk(r%dd\l m}m!}||�|jd]|f�(�ne|dUk(r%dd^l"m}m#}||�|jdU|f�(�n;|dSk(r6dd_l$m}m%}||
�|
jdS|f�(�n|jMd`�|jO|�a�}tQ|dbd
�|jRstU|�StS|�S)cNr)�progz	--versionz-vrz	%(prog)s z'Show program's version number and exit.)rEr�helpz--debugz-d�
store_truezFDEPRECATED: Show additional pre-action logging (default: %(default)s).F)rEry�defaultz--forcezPDEPRECATED: Force running even if no datasource is found (use at your own risk).r�)rEry�destr{z--all-stages�
all_stageszsRun cloud-init's stages under a single process using a syncronization protocol. This is not intended for CLI usage.)r|rEryr{r��Subcommands�
subcommand)�titler|rz>DEPRECATED: Initialize cloud-init and perform initial modules.)ry�--localz-lz+Start in local mode (default: %(default)s).z--filez-fr\r[z(Use additional yaml configuration files.�rb)rEr|ry�typerNr/z=DEPRECATED: Activate modules using a given configuration key.z`init`r"r#Tr�z--modez-m�storez9Module configuration name to use (default: %(default)s). r�)rr��final)rEryr{�choices�singlezDManually run a single module. Useful for testing during development.z--namez-nzModule name to run.)rEry�requiredz--frequencyzModule frequency for this run.)rEryr�r�z--reportzEnable reporting.r&�*�argumentz0Any additional arguments to pass to this module.)�nargs�metavarry�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.rZz/Report cloud-init status or wait on completion.�schemaz-Validate cloud-config files using jsonschema.c3�DK�|]}|jd�r�|���y�w)�-N)r�)�.0�posargs  r-�	<genexpr>zmain.<locals>.<genexpr>bs����J��6�3D�3D�S�3I�V�J�s� � )�
get_parser)r��handle_collect_logs_args)�parser)r��handle_clean_args)r��handle_args�render)r��handle_schema_args)r��handle_status_argsza subcommand is required�r`r�)+r�configure_root_loggerr&�argv�argparse�ArgumentParser�pop�add_argumentrrL�set_defaults�add_subparsers�
add_parser�FileTyperrr9�messager$rr(rNr-rvr��cloudinit.analyzer��cloudinit.cmd.devel.parser�cloudinit.cmd.devel.logsr��cloudinit.cmd.cleanr��cloudinit.cmd.queryr��cloudinit.config.schemar��cloudinit.cmd.statusr��error�
parse_args�setattrr}�sub_main)�	sysv_argsr��
subparsers�parser_init�
parser_mod�
extra_help�
parser_single�parser_query�parser_features�parser_analyze�parser_devel�parser_collect_logs�parser_clean�
parser_status�
parser_schemar�analyze_parser�devel_parser�logs_parserr��clean_parserr��query_parser�handle_query_args�
schema_parserr��
status_parserr�r`s                             r-�mainr��s���������H�H�	�
�
$�
$�)�-�-��*:�
;�F��������w�5�5�7�8�
6���������
.���	������
-����	�����
��
K���	������&��&�&�]��&�N�J��'�'��L�(��K�������
:����������
�
7�
�
�
�t�
$�
�����V�Y�$7��8��&�&��M�'��J��$�$��!�6��	�
�g����������|�
��+��
�������
�
7�
�
�
�t�
$�
�����I�|�#<��=��)�)��
*�*��M�������
"���������
-���%�*�*�,�-��������
 ��	��������
?�	��������
�
7�
�
�
�t�
$�
�����x��&=��>��(�(��
J�)��L�
!�+�+��1�,��O�� � ��]�(C� �D��*�*��G�+��N��(�(��.�)��L�%�/�/��I�0����(�(��K�)��L��)�)��H�*��M��)�)��F�*��M���J�)�J��
�
���"�F�
�>�*�
�7�
"�M�
��&�
�>�
)�
�

�2�3��,�,�&�(@�A�
-�
��7�
"�
�

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

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

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

�-�(��&�&�x�9K�.L�&�M����/�0����)��,�D��D�"�E�*��?�?���~���f��r.c���tjd�tjdddd�}tjd�|d�5|jddg�	�}d
|_t|�|_ddd�|d�5|jdg�	�}d|_t|�|_ddd�|d�5|jd
dg�	�}d|_t|�|_ddd�|d�5|jd
dg�	�}d|_t|�|_ddd�|jrLd}|jrd|j��}tjd|�d��tjd�ytjd�tjd�y#1swY��@xYw#1swY��xYw#1swY��xYw#1swY��xYw)z>Run all stages in a single process using an ordering protocol.z*Running cloud-init in single process mode.r�r�r�r�zREADY=1rr�r�FNTr/z
--mode=configz--mode=finalz%a stage of cloud-init exited non-zerozfirst exception received: zSTATUS=Completed with failure, z2. Run 'cloud-init status --long' for more details.z
STOPPING=1r0zSTATUS=Completed)r;r<r�
SocketSync�	sd_notifyr�r�r��systemd_exit_code�experienced_any_error�first_exception)r��syncr`r�s    r-r}r}�s����H�H�
9�:����W�i��7�C�D����Y��	
�g��0�� � �v�y�&9� �:��#���!)�$����0�
�i��0�� � �v�h� �/��"���!)�$����0�
�h��0�� � �y�/�&B� �C��"���!)�$����0�
�g��0�� � �y�.�&A� �B��"���!)�$����0��!�!�9�����2�4�3G�3G�2H�I�G����-�g�Y�7)�
)�	
�	����&�����+�,�����&�[0�0��0�0��0�0��0�0�s0�,F5�+G�,G�>,G�5F?�G�G�G$c	��|j\}}|dvr@tj|jrtj
ntj�n |jrtj�tj�d|k(sd|k(rd|jk7rt}d}d}|dk(r|jrd\}}ncd\}}n]|dk(rd|jzd|jz}}n9|d	k(r+d
|jzd|jz}}|j}n	|}d|z}d
}tj|||��|_|j 5t#j$t&jd|zd|||f��}ddd�t)j*�d|k(rd|jk(rt-�}S#1swY�>xYw)N)rr/rr/T)rzsearching for local datasources)zinit-networkz!searching for network datasourcesr0zrunning modules for %sr�z	single/%szrunning single module %szrunning 'cloud-init %s'F)�reporting_enabledzcloud-init mode '%s')�logfuncr,�
get_uptime�funcr`)rEr�setup_basic_loggingrjr�r��WARNINGr�attach_handlersr�r`r�r_�reportr�ReportEventStackr�r�log_timer;r�flush_eventsri)r`r_rX�rname�	report_on�rdesc�retvals       r-r�r��s����k�k�O�T�7��&�&����!�Z�Z�G�M�M�W�_�_�	
�
������!��"�"�$�
��~�)�t�+��$�)�)�0C� ���E��I��v�~��:�:�L�L�E�5��L�E�5�
��	��4�9�9�$�$�t�y�y�0���
��	��$�)�)�#�&����2����K�K�	���)�D�0���	��+�+�
�u�	��D�M�
���
�����I�I�&��-������
��
������D��V�t�y�y�0��V����M�
�
�s�.F9�9G�__main__�TZz:/etc/localtime)�rZ))r�r�)TN)Nr�rAr6r&r)r�r��typingrr�	cloudinitrrrrr	r
rrr
rrr�cloudinit.cmd.develr�cloudinit.configr�cloudinit.config.modulesrr�rr�cloudinit.reportingr�cloudinit.settingsrrrrrJrgr(r>r;�__name__r;r*r:r@rFrCrjr�rXrcrqrvr~�intr�r�r�rrr$r-r`r�r�r�rvr�r}r��environr��return_value�exitr�r.r-�<module>r�s�����	�
����"��$���� �����#��.�,�,�?��&���(��%��
����� ��$�"�	�
��g����!��
�:��H���14�	�	�5��#����-�5�
��W��&=�
K�j�U�3��8�_�j�ZE�<�_C�D/�d>0�BC�LV#�rE�v�{�{�E��.A�z�z8'�vG�T�z���2�:�:��,��
�
�4������>�L���������	r.

Zerion Mini Shell 1.0