__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

x[h;���F�SrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	J
r
JrJrJ
r
JrJr SSKJr SSKJr SSKJrJrJr Sr\R2"\5rSrS	rS
rSrSr S
r!Sr"Sr#Sr$Sr%Sr&Sr'Sr("SS\RR5r*Sr+Sr,Sr-Sr.Sr/Sr0Sr1Sr2Sr3S r4S!r5S"r6S#r7S$r8S%r9S&r:S'r;S(r<\*\Rz44\*\Rz\R|44/r?S)r@S*rAS5S+jrBS,rCS-\DS.\D4S/jrES-\DS.\D4S0jrFS1rGS2rHS3rI\S4:Xa\I"5 gg)6z�Cloud-Init DataSource for VMware

This module provides a cloud-init datasource for VMware systems and supports
multiple transports types, including:

    * EnvVars
    * GuestInfo
    * IMC (Guest Customization)
�N)�
atomic_helper�dmi�net�netinfo�sources�util)�loggers)�guestcust_util)�ProcessExecutionError�subp�whichz/sys/class/dmi/id/product_uuidzNo value found�envvar�	guestinfo�imc�redactzcleanup-guestinfo�
VMX_GUESTINFOz---z
local-ipv4z
local-ipv6zwait-on-network�ipv4�ipv6c�^�\rSrSrSrSrSSjrS\SS4U4SjjrS	r	S
r
SrSrS
r
\S5rSrSrSrSrSrSrSrSrU=r$)�DataSourceVMware�9a
Setting the hostname:
    The hostname is set by way of the metadata key "local-hostname".

Setting the instance ID:
    The instance ID may be set by way of the metadata key "instance-id".
    However, if this value is absent then the instance ID is read
    from the file /sys/class/dmi/id/product_uuid.

Configuring the network:
    The network is configured by setting the metadata key "network"
    with a value consistent with Network Config Versions 1 or 2,
    depending on the Linux distro's version of cloud-init:

        Network Config Version 1 - http://bit.ly/cloudinit-net-conf-v1
        Network Config Version 2 - http://bit.ly/cloudinit-net-conf-v2

    For example, CentOS 7's official cloud-init package is version
    0.7.9 and does not support Network Config Version 2.

    imc transport:
        Either Network Config Version 1 or Network Config Version 2 is
        supported which depends on the customization type.
        For LinuxPrep customization, Network config Version 1 data is
        parsed from the customization specification.
        For CloudinitPrep customization, Network config Version 2 data
        is parsed from the customization specification.

    envvar and guestinfo transports:
        Network Config Version 2 data is supported as long as the Linux
        distro's cloud-init package is new enough to parse the data.
        The metadata key "network.encoding" may be used to indicate the
        format of the metadata key "network". Valid encodings are base64
        and gzip+base64.
�VMwareNc��[RRXX#U5 0UlSUlSUlSUl[URS4[URS4[URS4/Ul
g)NFT)r�
DataSource�__init__�cfg�data_access_method�rpctool�
rpctool_fn�DATA_ACCESS_METHOD_ENVVAR�get_envvar_data_fn�DATA_ACCESS_METHOD_GUESTINFO�get_guestinfo_data_fn�DATA_ACCESS_METHOD_IMC�get_imc_data_fn� possible_data_access_method_list)�self�sys_cfg�distro�paths�ud_procs     �D/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceVMware.pyr�DataSourceVMware.__init__`ss�����#�#�D�6�'�J����"&���������'��(?�(?��G�
)�4�+E�+E�t�L�
#�T�%9�%9�4�@�1
��-��ci_pkl_version�returnc	�X>�[TU]U5 SH!n[X5(aM[XS5 M# [US5(d
[US05 [US5(dD[US[UR
S4[URS4[URS4/5 gg)N)rrrr&FT)
�super�	_unpickle�hasattr�setattrr r!r"r#r$r%)r'r/�attr�	__class__s   �r,r3�DataSourceVMware._unpickleus����
���.�)�-�D��4�&�&���D�)�.��t�U�#�#��D�%��$��t�?�@�@���2�2��/�/���5��2�2���
,�T�-A�-A�4�H��
�Ar.c�h�[RRU5nU<SUR<S3$)Nz [seed=�])rr�__str__r)r'�roots  r,r;�DataSourceVMware.__str__�s)���!�!�)�)�$�/��!%�t�'>�'>�?�?r.c�"�SupnURHFunnnU(a[5(dMU"5upnU(dU(d	U(dM@X@l O UR(d[R	S5 g[RSUR
55 [[U55Ul	X l
X0lUR5 UR(d"UR(dUR(agg)aC
_get_data loads the metadata, userdata, and vendordata from one of
the following locations in the given order:

    * envvars
    * guestinfo
    * imc

Please note when updating this function with support for new data
transports, the order should match the order in the dscheck_VMware
function from the file ds-identify.
�NNNz)failed to find a valid data access methodFzusing data access method %sT)
r&�is_vmware_platformr�LOG�debug�info�_get_subplatform�process_metadata�load_json_or_yaml�metadata�userdata_raw�vendordata_raw�redact_keys)r'�md�ud�vdr�get_data_fn�require_vmware_platforms       r,�	_get_data�DataSourceVMware._get_data�s���"&�
����
2�
2�	
���#�&�/A�/C�/C��&�=�L�R�R��R�2�2�*<�'��
3��&�&��I�I�A�B�����.��0E�0E�0G�H�)�):�2�)>�?��
���!��	
�����=�=�D�-�-��1D�1D��r.c��[UR5n[RSU5 [	X R
UR5 [R"URU/5UlUR5 g)asetup(is_new_instance)

This is called before user-data and vendor-data have been processed.

Unless the datasource has set mode to 'local', then networking
per 'fallback' or per 'network_config' will have been written and
brought up the OS at this point.
zgot host-info: %sN)
�wait_on_networkrGrArC�advertise_local_ip_addrsrrr�
mergemanydict�persist_instance_data)r'�is_new_instance�	host_infos   r,�setup�DataSourceVMware.setup�s`��$�D�M�M�2�	����$�i�0�	!��L�L�$�/�/�J�
�*�*�D�M�M�9�+E�F��
�	
�"�"�$r.c��SnUR[:Xa[nOFUR[:Xa[nO+UR[
:Xa[nO[R$UR<SU"S5<S3$)Nz (rG�))	rr �get_guestinfo_envvar_key_namer"�get_guestinfo_key_namer$�get_imc_key_namer�METADATA_UNKNOWN)r'�get_key_name_fns  r,rD�!DataSourceVMware._get_subplatform�sl�����"�"�&?�?�;�O�
�
$�
$�(D�
D�4�O�
�
$�
$�(>�
>�.�O��+�+�+�
�#�#��J�'�
�	
r.c��UR$�N)r�r's r,�get_config_obj�DataSourceVMware.get_config_obj�s���x�x�r.c���SUR;a[RS5 O>[RS5 SURR	50URS'URSS$)N�networkzusing metadata network configzusing fallback network config�config)rGrArBr)�generate_fallback_configres r,�network_config�DataSourceVMware.network_config�s`����
�
�%��I�I�5�6��I�I�5�6��$�+�+�>�>�@�(�D�M�M�)�$��}�}�Y�'��1�1r.c��UR(aSUR;aURS$[R"[5R	5R5URS'URS$)Nzinstance-id)rGr�load_text_file�PRODUCT_UUID_FILE_PATH�rstrip�lowerres r,�get_instance_id� DataSourceVMware.get_instance_id	se���=�=�]�d�m�m�;��=�=��/�/���� 6�7�>�>�@�F�F�H�	
�
�
�m�$��}�}�]�+�+r.c��UR(aHUR[:Xa4[5(a%[R	SUR55 gg)Nz"Cache fallback is allowed for : %sTF)rr$r@rArBrDres r,�check_if_fallback_is_allowed�-DataSourceVMware.check_if_fallback_is_allowedsE���#�#��'�'�+A�A�"�$�$��I�I�4�d�6K�6K�6M�
��r.c��SH7nXR;dM[R"URU5s $ /$)N)zpublic-keys-data�public_keys_datazpublic-keys�public_keys)rGr�normalize_pubkey_data)r'�key_names  r,�get_public_ssh_keys�$DataSourceVMware.get_public_ssh_keyss;��
�H��=�=�(��4�4�T�]�]�8�5L�M�M�
��	r.c��Sn[UR;aUR[nO'[UR;aUR[nUR[:Xa![XRUR5 ggrd)�REDACTrG�CLEANUP_GUESTINFOrr"�guestinfo_redact_keysrr)r'�keys_to_redacts  r,rJ�DataSourceVMware.redact_keys*sf�����T�]�]�"�!�]�]�6�2�N�
�$�-�-�
/�!�]�]�+<�=�N��"�"�&B�B�!����d�o�o�
�Cr.c��Supn[RR[S5(a![	S5n[	S5n[	S5nXU4$)z,
check to see if there is data via env vars
r?�rG�userdata�
vendordata)�os�environ�getr�guestinfo_envvar)r'rKrLrMs    r,r!�#DataSourceVMware.get_envvar_data_fn8sJ��&�
���
�:�:�>�>�-��,�,�!�*�-�B�!�*�-�B�!�,�/�B���|�r.c�x�[S5n[S5nU(a'X l[Ul[RSU5 U(a.U(dXl[Ul[RSU5 UR(d[RS5 gSnU"URUR5$![a�n[R"[SURU5 U(aURU:XaS	nAgU(d[RS
5 S	nAg[RS5 Xl[UlU"URUR5sS	nA$![a. [R"[SURU5 S	nAgf=fS	nAff=f)z;
check to see if there is data via the guestinfo transport
�vmtoolsdzvmware-rpctoolzdiscovered vmware-rpctool: %szdiscovered vmtoolsd: %szno rpctool discoveredr?c��Sup#n[RSU5 [SX5n[SX5n[SX5nX#U4$)Nr?zquery guestinfo with %srGr�r�)rArCr)rrrKrLrMs     r,�query_guestinfo�?DataSourceVMware.get_guestinfo_data_fn.<locals>.query_guestinfo`sH��)�J�B�B��H�H�.��8��:�w�;�B��:�w�;�B��<��=�B��2�:�r.z%Failed to query guestinfo with %s: %sNz$vmtoolsd fallback option not presentzfallback to vmtoolsd)r
r�exec_vmware_rpctoolrrArB�
exec_vmtoolsd�	Exceptionr�logexcrC)r'r��vmware_rpctoolr��errors     r,r#�&DataSourceVMware.get_guestinfo_data_fnDsJ��
��$���/�0���)�L�1�D�O��I�I�5�~�F��"�'��"/����I�I�/��:��|�|��I�I�-�.�%�	�&	*�#�4�<�<����A�A���"	*��K�K��7�����	
��D�L�L�H�4�)�����?�@�)��H�H�+�,�#�L�+�D�O�

*�&�t�|�|�T�_�_�E�E���
*�����;��L�L��	�*�
*��5"	*�sH�%C�
F9�>F4�F4�0&F4�E9�3F9�91F1�*F4�0F1�1F4�4F9c���Supn[R"UR5n[R"UR5nU(d U(d[
R
S5 XU4$[R"5(dXU4$[R"UR5nUcXU4$[RRU5n[R"U5n[R"U5un	n
U	(avU(ao[
R
S5 [R"URR URR#S5UUUR$5upo0lORU
(a6U(a/[
R
S5 [R("U5upnO[
R
S5 [*R,"U5 XU4$)z>
check to see if there is data via vmware guest customization
r?z-Customization for VMware platform is disabledz3Getting data via VMware customization configuration�scriptszFGetting data via VMware raw cloudinit data customization configurationz1No allowed customization configuration data found)r
�is_vmware_cust_enabledr(�is_raw_data_cust_enabled�ds_cfgrArB�is_cust_plugin_available�get_cust_cfg_filer��path�dirname�parse_cust_cfg�get_cust_cfg_type�get_data_from_imc_cust_cfgr*�	cloud_dir�	get_cpathr)r�#get_data_from_imc_raw_data_cust_cfgr�del_dir)r'rKrLrM�allow_vmware_cust�allow_raw_data_cust�
cust_cfg_file�cust_cfg_dir�cust_cfg�is_vmware_cust_cfg�is_raw_data_cust_cfgs           r,r%� DataSourceVMware.get_imc_data_fn�s���&�
���+�A�A�$�,�,�O��,�E�E��K�K�
��!�)<��I�I�E�F��B�<���6�6�8�8��B�<��'�8�8����E�
�� ��B�<���w�w���}�5��!�0�0��?��
�,�,�X�6�	
�� ��"3��I�I�K�L�%3�%N�%N��
�
�$�$��
�
�$�$�Y�/������&�"�R�R��"�&9��I�I�.�
�*�M�M���L�R�R�
�I�I�I�J�	
���\�"���|�r.)rrrGr&rrrHrIrd)�__name__�
__module__�__qualname__�__firstlineno__�__doc__�dsnamer�intr3r;rPrYrDrf�propertyrlrsrvr}rJr!r#r%�__static_attributes__�
__classcell__)r7s@r,rr9s����"�H�F�
�*�����4@�7�r%�8
�&��2��2�,�
�	��
�J*�X7�7r.rc��[R"S5nUc[RS5 gSUR	5;a[RS5 gg)Nzsystem-product-namezNo system-product-name foundF�vmwarezNot a VMware platformT)r�
read_dmi_datarArBrr)�system_types r,r@r@�sM���#�#�$9�:�K����	�	�0�1��	��*�*�,�	,��	�	�)�*��r.c��[RSX5 SnUS;aA[RSX5 [R"[R
"U55nOKUS;a-[RSX5 [R
"U5nO[RSU5 Un[R"U5$)zy
decode returns the decoded string value of data
key is a string used to identify the data being decoded in log messages
z'Getting encoded data for key=%s, enc=%sN)zgzip+base64zgz+b64zDecoding %s format %s)�base64�b64zPlain-text data %s)rArBr�decomp_gzipr�b64d�
decode_binary)�key�enc_type�data�raw_datas    r,�decoder��s���
�I�I�7��G��H��,�,��	�	�)�8�9��#�#�M�$6�$6�t�$<�=��	�&�	&��	�	�)�8�9� �%�%�d�+���	�	�&��,������h�'�'r.c�v�[R"U5nUR5nU(a
U[:XagU$)z�
get_none_if_empty_val returns None if the provided value, once stripped
of its trailing whitespace, is empty or equal to GUESTINFO_EMPTY_YAML_VAL.

The return value is always a string, regardless of whether the input is
a bytes class or a string.
N)rr�rq�GUESTINFO_EMPTY_YAML_VAL)�vals r,�get_none_if_empty_valr��s2���
�
�S�
!�C�

�*�*�,�C��S�4�4���Jr.c�>�U(aU(aU(dgUR[5nU(a'[[X1U5 [R	SU5 UR[
5nU(a([[
XAU5 [R	SU5 gg)z�
advertise_local_ip_addrs gets the local IP address information from
the provided host_info map and sets the addresses in the guestinfo
namespace
Nz-advertised local ipv4 address %s in guestinfoz-advertised local ipv6 address %s in guestinfo)r��
LOCAL_IPV4�guestinfo_set_valuerArC�
LOCAL_IPV6)rXrr�
local_ipv4�
local_ipv6s     r,rTrT�sm���G�:�����z�*�J���J�
�Z�H����@�*�M����z�*�J���J�
�Z�H����@�*�M�r.c�X�[U5nU(aU$[RSU5 g)z�
handle_returned_guestinfo_val returns the provided value if it is
not empty or set to GUESTINFO_EMPTY_YAML_VAL, otherwise None is
returned
�No value found for key %sN)r�rArB)r�r�s  r,�handle_returned_guestinfo_valr�s(�� ��
$�C�
��
��I�I�)�3�/�r.c��g)Nzvmware-tools��r�s r,r_r_s��r.c��SU-$)Nz
guestinfo.r�r�s r,r^r^#s
���#��r.c�\�S[U5-R5RSSS5$)Nzvmx.�.�_���)r^�upper�replacer�s r,r]r]'s+���+�C�0�0�7�7�9�A�A�#�s�B�O�Or.c�n�[U5nU(dg[US-5n[[U5X!5$)N�	.encoding)�guestinfo_envvar_get_valuer�r])r�r�r�s   r,r�r�+s4��
$�S�
)�C���)�#��*;�<�H��/��4�h�D�Dr.c�l�[U5n[U[RR	US55$)Nr�)r]r�r�r�r�)r��env_keys  r,r�r�3s(��+�C�0�G�(��b�j�j�n�n�W�b�.I�J�Jr.c�$�[X/5up#X#4$rd�r�r�arg�stdout�stderrs    r,r�r�8s���W�N�+��V���r.c�(�[USU/5up#X#4$)Nz--cmdr�r�s    r,r�r�=s���W�g�s�3�4��V���r.c�r�[XU5nU(dg[US-X5n[[U5XC5$)z^
guestinfo returns the guestinfo value for the provided key, decoding
the value when required
Nr�)�guestinfo_get_valuer�r^)r�rrr�r�s     r,rrBs:��
�c�J�
7�C���"�3��#4�g�J�H��(��-�x�=�=r.c��[RSU5 U"US[U5-5up4U[:Xa[RSU5 OU(d[R	SU5 [X5$![aSnUR[:XaSU5 SnAg[R"[SUU5 UeSnAf[a$n[R"[SUU5 UeSnAff=f)z2
Returns a guestinfo value for the specified key.
z"Getting guestinfo value for key %sz	info-get r�z(Failed to get guestinfo value for key %sz,Failed to get guestinfo value for key %s: %sNzCUnexpected error while trying to get guestinfo value for key %s: %s)rArBr^�NOVALr�r�rr�rr�r�)r�rrr�r�r�s      r,r�r�Ns����I�I�2�C�8�!�%��[�#9�#�#>�>�
����U�?��I�I�1�3�7���I�I�@�#�F�,�S�9�9�� ���<�<�5� ��I�I�1�3�7�7�,�#
�K�K��>���	
��K��������
-���	
�����s*�AA8�8
D�*C�1C�
D�C<�<Dc�0�US:XaSn[RSX5 U"US[U5<SU<35 g![a(n[R
"[SUUU5 SnAgSnAf[a  [R
"[SUU5 gf=f)	zp
Sets a guestinfo value for the specified key. Set value to an empty string
to clear an existing guestinfo key.
r�� z$Setting guestinfo key=%s to value=%sz	info-set Tz.Failed to set guestinfo key=%s to value=%s: %sNzAUnexpected error while trying to set guestinfo key=%s to value=%s)rArBr^rrr�r�)r��valuerrr�s     r,r�r�zs���
��{����I�I�4�c�A�
���)?��)D�e�L�	
��� �

�	
����<����	
�	
� ���
�����
+���	
��
�s�;�
B�A(�(*B�Bc�~�U(dg[U5[[4;aU/nUH�n[U5n[RSU5 [
U[X5(d[RSU5 [RSU5 [
US-SX5(aM}[RSU5 M� g)z�
guestinfo_redact_keys redacts guestinfo of all of the keys in the given
list. each key will have its value set to "---". Since the value is valid
YAML, cloud-init can still read it if it tries.
Nzclearing %szfailed to clear %szclearing %s.encodingr�r�zfailed to clear %s.encoding)	�type�list�tupler^rArCr�r�r�)�keysrrr�r|s     r,r�r��s������D�z�$���&��v����)�#�.�������)�"��)�7�
�
�
�I�I�*�H�5����'��2�"�3��#4�b�'�N�N��I�I�3�X�>�r.c���U(d0$[U[5(aU$[R"U5$![R
[4a [R"U5s$f=f)z�
load first attempts to unmarshal the provided data as JSON, and if
that fails then attempts to unmarshal the data as YAML. If data is
None then a new dictionary is returned.
)�
isinstance�dictr�	load_json�json�JSONDecodeError�	TypeError�	load_yaml)r�s r,rFrF�s[����	��$������$��~�~�d�#�#��� � �)�,�$��~�~�d�#�#�$�s�8�0A+�*A+c��U(d0$SnSU;aUSnUS	SnSU;aUSnUS	U(a�[U[RR5(a.[RS5 S[R"U50nO/[RSU5 [SX!5nS[U50n[RSU5 XS'U$)	zS
process_metadata processes metadata and loads the optional network
configuration.
Nriznetwork.encodingz#network data copied to 'config' keyrjznetwork data to be decoded %szmetadata.networkznetwork data %s)
r��collections�abc�MappingrArB�copy�deepcopyr�rF)r�ri�network_enc�dec_nets    r,rErE�s���
��	��G��D���y�/����O��K��T�!��-�.���#�$���g�{���6�6�7�7��I�I�;�<�����w�!7�8�G��I�I�5�w�?��/��F�G��+�G�4��G�	�	�	�#�W�-�!�Y���Kr.c�8�[R"U[5$)zC
Return a list of data sources that match this set of dependencies
)r�list_from_depends�datasources)�dependss r,�get_datasource_listr�s���$�$�W�k�:�:r.c�T�SnSn[R"5nUSHnUSS:XdMUSn O USHnUSS:XdMUSn O SnSn[R"5nX;aMX`Sn[U5S:�a[RS	X5 O [U5S:XaS
US;aUSS
nX;aMXaSn[U5S:�a[RSX5 O [U5S:XaS
US;aUSS
nUbIUcFUH@nXhSH2n	U	S
U:XdM[XhS5S:XdM$XhSSS
n M> MB UcIUbFUH@nXhSH2n	U	S
U:XdM[XhS5S:XdM$XhSSS
n M> MB XE4$)
a1
Returns the default IPv4 and IPv6 addresses based on the device(s) used for
the default route. Please note that None may be returned for either address
family if that family has no default route or if there are multiple
addresses associated with the device used by the default route for a given
address.
Nr�destination�0.0.0.0�ifacerz::/0�z,device %s has more than one ipv4 address: %s�iprz,device %s has more than one ipv6 address: %s)r�
route_info�netdev_info�lenrArB)
�ipv4_if�ipv6_if�routes�routerr�netdev�addrs�dev_name�addrs
          r,�get_default_ip_addrsr �s����G��G�
�
�
�
!�F��������9�,��G�n�G�� ��������6�)��G�n�G�� ��D��D�
�
 �
 �
"�F������'���u�:��>��I�I�>��
���Z�1�_���q��!1���8�D�>�D������'���u�:��>��I�I�>��
���Z�1�_���q��!1���8�D�>�D�
��D�L��H��(��0����:��%�#�f�.>�v�.F�*G�1�*L�!�+�F�3�A�6�t�<�D��1���|��(��H��(��0����:��%�#�f�.>�v�.F�*G�1�*L�!�+�F�3�A�6�t�<�D��1���:�r.c�H�UR5nU(aUS:Xa[R"5n[R"USS[R
S[R5nUHnUS(dMUSn U$ U$![Ra U$f=f)zgGet fully qualified domain name from name.
An empty argument is interpreted as meaning the local host.
rNr�)�stripr�get_hostname�socket�getaddrinfo�
SOCK_DGRAM�AI_CANONNAMEr�)�namerrs   r,�getfqdnr*>s����:�:�<�D��4�9�$�� � �"��
��"�"��$��6�,�,�a��1D�1D�
���D��A�w�w��A�w����K�	��K���<�<�
���K�
�s�7B	�	B!� B!c���[R"[RU5nU=(a7 UR=(d UR
=(d UR(+$)zb
Returns false if the address is loopback, link local or unspecified;
otherwise true is returned.
)r�maybe_get_address�	ipaddress�
ip_address�
is_link_local�is_loopback�is_unspecified)r�rs  r,�is_valid_ip_addrr2UsM��
� � ��!5�!5�s�;�D������E�d�.�.�E�$�2E�2E��r.rr0c��URS5(d0$URS5URS5URS5S.$)a�
Takes a cloudinit.netinfo formatted address and converts to netifaces
format, since this module was originally written with netifaces as the
network introspection module.
netifaces ipv4 format:
{
  "broadcast": "10.15.255.255",
  "netmask": "255.240.0.0",
  "addr": "10.0.1.4"
}
cloudinit.netinfo ipv4 format:
{
  "ip": "10.0.1.4",
  "mask": "255.240.0.0",
  "bcast": "10.15.255.255",
  "scope": "global",
}
r�bcast�mask)�	broadcast�netmaskr)r�)rs r,� convert_to_netifaces_ipv4_formatr8`sC��&�8�8�D�>�>��	��X�X�g�&��8�8�F�#�������r.c���URS5(d0$[R"URS55nURSURR
3[
UR5S.$)ao
Takes a cloudinit.netinfo formatted address and converts to netifaces
format, since this module was originally written with netifaces as the
network introspection module.
netifaces ipv6 format:
{
  "netmask": "ffff:ffff:ffff:ffff::/64",
  "addr": "2001:db8:abcd:1234::1"
}
cloudinit.netinfo ipv6 format:
{
  "ip": "2001:db8:abcd:1234::1/64",
  "scope6": "global",
}
r�/)r7r)r�r-�
IPv6Interfacer7ri�	prefixlen�strr)rrs  r,� convert_to_netifaces_ipv6_formatr>|s`�� �8�8�D�>�>��	��"�"�4�8�8�D�>�2�D��l�l�^�1�T�\�\�%;�%;�$<�=��D�G�G���r.c��SS[R"5[R"5[R"5S.00n[[R"55nU(aXS'XS'XS'[5up#U(aX ['U(aX0['USSSnUSSSnUSSS	n[R"5nUGH�n/n	/n
XxS
HnU	R[U55 M XxSHnU
R[U55 M XxRS5nUS
:XaMsU(a�U	(dU
(a�Un
0nU	(a5/nU	H)n[US5(dMURU5 M+ X�S
'U
(a6/nU
H)n[US5(dMURU5 M+ UUS'X�U
'U	(aHU	HBnUSn
[U
5(dM[R "U5nUS	U(aX�S'X�U
'MD U
(dGMbU
HBnUSn
[U
5(dM[R "U5nUS	U(aX�S'X�U
'MD GM� U$)zH
Returns host information such as the host name and network interfaces.
ri�
interfaces)�by-mac�by-ipv4�by-ipv6�hostnamezlocal-hostname�local_hostnamerArBrCrr�hwaddrz00:00:00:00:00:00r�mac)r�OrderedDictr*rr$r r�r�rr�appendr8r>r�r2rr)rXrD�default_ipv4�default_ipv6�by_mac�by_ipv4�by_ipv6�ifacesr�af_inet4�af_inet6rrGr�r��
af_inet4_vals�ip_info�
af_inet6_valss                  r,�
get_host_inforU�s���
	��%�1�1�3�&�2�2�4�&�2�2�4��
��I��t�(�(�*�+�H�� (�*��&.�"�#�&.�"�#�!5�!7��L�� ,�*��� ,�*��
�y�
!�,�
/��
9�F��	�"�<�0��;�G��	�"�<�0��;�G�
�
 �
 �
"�F��������$�V�,�D��O�O�<�T�B�C�-��$�V�,�D��O�O�<�T�B�C�-���"�"�8�,���%�%���H���C��C�� "�
�'�G�+�G�F�O�<�<� �!�(�(��1� (�,�F��� "�
�'�G�+�G�F�O�<�<� �!�(�(��1� (�,��F���3�K��#���f�o��'��,�,���m�m�G�,����K��!$��J�"���$��8�#���f�o��'��,�,���m�m�G�,����K��!$��J�"���$�[�n�r.c�`�SnSn[U;a�U[n[U;a7U[n[U[5(aUnO[R
"U5n[U;a7U[n[U[5(aUnO[R
"U5nSupgnUc�[5nURS5=(d 0n	U	RS5=(d 0n
U
RS5=(d 0nU
RS5=(d 0nU(a U(a[U5S:�OSnU(dSnU(a U(a[U5S:�OSnU(dSnUc/[RSUUUU5 [R"S	5 UcM�[RS
5 U$)NF)NFFrir@rBrCrz<waiting on network: wait4=%s, ready4=%s, wait6=%s, ready6=%srzwaiting on network complete)�WAIT_ON_NETWORK�WAIT_ON_NETWORK_IPV4r��boolr�translate_bool�WAIT_ON_NETWORK_IPV6rUr�rrArB�time�sleep)
rG�wait_on_ipv4�wait_on_ipv6rS�wait_on_ipv4_val�wait_on_ipv6_valrX�
ipv4_ready�
ipv6_readyrir@rMrNs
             r,rSrS�sz���L��L��(�"�"�?�3���?�2�.�/C�D���*�D�1�1�/��#�2�2�3C�D���?�2�.�/C�D���*�D�1�1�/��#�2�2�3C�D��);�%�I�:�
�
�"�O�	��-�-�	�*�0�b���[�[��.�4�"�
��.�.��+�1�r���.�.��+�1�r���-4��W���)�%�J�� �	��-4��W���)�%�J�� �	����I�I�N�����
�
�J�J�q�M�;�
�>�I�I�+�,��r.c��[R"5 [[S[
S0SSSS000n[
U5n[R"X/5n[[R"U55 g![a Nhf=f)z/
Executed when this file is used as a program.
TFrirj�dhcpN)r	�setup_basic_loggingr�rWrXr[rSrrU�printr�
json_dumps)rGrXs  r,�mainri%s���
��#�#�%�	� �$� �%�
�	�H�v�t�n�-��H� ��)�I��!�!�8�"7�8�H�	�-�
"�
"�8�
,�-���
��
�s�A3�3
B�?B�__main__)r�)Jr�rrr-r��loggingr�r%r\�	cloudinitrrrrrr�
cloudinit.logr	�$cloudinit.sources.helpers.vmware.imcr
�cloudinit.subprrr
rp�	getLoggerr�rAr�r r"r$r�r�rr�r�r�rWrXr[rrr@r�r�rTr�r_r^r]r�r�r�r�rr�r�r�rFrE�DEP_FILESYSTEM�DEP_NETWORKrrr r*r2r�r8r>rUrSrir�r.r,�<module>rss���������	�
��E�E�!�?�=�=�9��
����!����%��*����	��'���
� ��
�
�
�
�#������N�w�)�)�N�b�(�*�$N�,
���P�E�K�
�
�
	>�)�X(�V?�,$�"�H��.�.�0�1���.�.��0C�0C�D�E���;�?�D�.��4��D��8�4��D��2U�p5�p.�(�z���F�r.

Filemanager

Name Type Size Permission Actions
DataSourceAkamai.cpython-313.pyc File 12.33 KB 0644
DataSourceAliYun.cpython-313.pyc File 18.33 KB 0644
DataSourceAltCloud.cpython-313.pyc File 9.85 KB 0644
DataSourceAzure.cpython-313.pyc File 79.75 KB 0644
DataSourceBigstep.cpython-313.pyc File 2.86 KB 0644
DataSourceCloudCIX.cpython-313.pyc File 7.22 KB 0644
DataSourceCloudSigma.cpython-313.pyc File 5.18 KB 0644
DataSourceCloudStack.cpython-313.pyc File 13.11 KB 0644
DataSourceConfigDrive.cpython-313.pyc File 14.2 KB 0644
DataSourceDigitalOcean.cpython-313.pyc File 6.2 KB 0644
DataSourceEc2.cpython-313.pyc File 43.31 KB 0644
DataSourceExoscale.cpython-313.pyc File 8.9 KB 0644
DataSourceGCE.cpython-313.pyc File 16.12 KB 0644
DataSourceHetzner.cpython-313.pyc File 6.46 KB 0644
DataSourceIBMCloud.cpython-313.pyc File 18.43 KB 0644
DataSourceLXD.cpython-313.pyc File 20.3 KB 0644
DataSourceMAAS.cpython-313.pyc File 18.29 KB 0644
DataSourceNWCS.cpython-313.pyc File 6.76 KB 0644
DataSourceNoCloud.cpython-313.pyc File 17.26 KB 0644
DataSourceNone.cpython-313.pyc File 1.88 KB 0644
DataSourceOVF.cpython-313.pyc File 15.34 KB 0644
DataSourceOpenNebula.cpython-313.pyc File 18.96 KB 0644
DataSourceOpenStack.cpython-313.pyc File 13.1 KB 0644
DataSourceOracle.cpython-313.pyc File 21.77 KB 0644
DataSourceRbxCloud.cpython-313.pyc File 10.25 KB 0644
DataSourceScaleway.cpython-313.pyc File 17.07 KB 0644
DataSourceSmartOS.cpython-313.pyc File 38.32 KB 0644
DataSourceUpCloud.cpython-313.pyc File 7.11 KB 0644
DataSourceVMware.cpython-313.pyc File 35.8 KB 0644
DataSourceVultr.cpython-313.pyc File 5.79 KB 0644
DataSourceWSL.cpython-313.pyc File 15.48 KB 0644
__init__.cpython-313.pyc File 47.24 KB 0644
Filemanager