Current File : //usr/lib/python3/dist-packages/cloudinit/sources/__pycache__/DataSourceVMware.cpython-312.pyc |
�
Ӈg=� � �> � d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl m
Z
mZmZm
Z
mZmZ ddlmZ ddlmZ ddlmZmZmZ dZ ej2 e� ZdZd Zd
ZdZdZ d
Z!dZ"dZ#dZ$dZ%dZ&dZ'dZ( G d� dejR � Z*d� Z+d� Z,d� Z-d� Z.d� Z/d� Z0d� Z1d� Z2d� Z3d � Z4d!� Z5d"� Z6d#� Z7d$� Z8d%� Z9d&� Z:d'� Z;d(� Z<e*ejz ffe*ejz ej| ffgZ?d)� Z@d*� ZAd5d+�ZBd,� ZCd-eDd.eDfd/�ZEd-eDd.eDfd0�ZFd1� ZGd2� ZHd3� ZIed4k( r eI� yy)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 � � � e Zd ZdZdZdd�Zdeddf� fd�Zd� Zd � Z d
� Z
d� Zd� Ze
d
� � Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z� xZS )�DataSourceVMwareav
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 � � t j j | ||||� i | _ d | _ d | _ d | _ t | j dft | j dft | j dfg| _
y )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 zDataSourceVMware.__init__` sw � ����#�#�D�'�6�5�'�J����"&��������� '��(?�(?��G�
)�4�+E�+E�t�L�
#�T�%9�%9�4�@�1
��-� �ci_pkl_version�returnc �8 �� t �| � |� dD ] }t | |� r�t | |d � � t | d� s
t | di � t | d� sDt | dt | j
dft | j dft | j dfg� y y )N)r r r r% FT)
�super� _unpickle�hasattr�setattrr r r! r"