| Server IP : 3.96.16.70 / Your IP : 216.73.216.15 Web Server : Apache System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3.9/site-packages/cloudinit/sources/__pycache__/ |
Upload File : |
a
�½b@z � @ s� d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlmZ d dlm
Z
mZmZm
Z
d dlmZ d dlmZmZ d dlmZ d d lmZ d d
lmZ d dlmZ d dlmZ d d
lmZ d dl m!Z!m"Z"m#Z#m$Z$m%Z% e �&e'�Z(dZ)dZ*dZ+G dd� dej,�Z-G dd� de-�Z.dd� Z/dDdd�Z0dEdd�Z1dFd d!�Z2d"d#� Z3dGd$d%�Z4d&d'� Z5d(d)� Z6dHd*d+�Z7d,d-� Z8d.d/� Z9d0d1� Z:d2d3� Z;G d4d5� d5e<�Z=e-ej>ffe.ej>ej?fffZ@d6d7� ZAd8d9� ZBd:d;� ZCd<d=� ZDd>d?� ZEd@dA� ZFdBdC� ZGdS )I� N)�minidom)�dmi)�log)�safeyaml�sources�subp�util)�Config)�PostCustomScript�PreCustomScript)�
ConfigFile)�NicConfigurator)�PasswordConfigurator)�GuestCustErrorEnum)�GuestCustEventEnum)�GuestCustStateEnum)�enable_nics�get_nics_to_enable�get_tools_config�set_customization_status�
set_gc_statusZ deployPkgzenable-custom-scripts�/var/run/vmware-imcc @ sL e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z e
dd� �ZdS )�
DataSourceOVFZOVFc C s^ t j�| |||� d | _tj�|jd�| _d | _i | _ d| _
d| _d | _d | _
d | _d| _d S )NZovf)�/zfile://TF)r �
DataSource�__init__�seed�os�path�join�seed_dir�environment�cfg�supported_seed_starts�vmware_customization_supported�_network_config�_vmware_nics_to_enable�_vmware_cust_conf�_vmware_cust_found��self�sys_cfg�distro�paths� r. �C/usr/lib/python3.9/site-packages/cloudinit/sources/DataSourceOVF.pyr : s zDataSourceOVF.__init__c C s t j�| �}d|| jf S )Nz%s [seed=%s])r r �__str__r )r* �rootr. r. r/ r0 G s zDataSourceOVF.__str__c /
C s� g }i }d}d}d }d }ddi}t | jj�\}} t�d�}
|
d u rLt�d� |r�tj� | jj|�}t
| �\}}}| | _|�|� �n�|
�r*d|
�
� v �r*t�d� d}
d}| js�t�d � n"t�| jd
d� }
t�| jdd�}|
s�|s�t�d
� �n6d}d}d }|D ](}t||�}|�rt�d|� �q.�q|�rXt| j�}tjtjdtd|fd�}n
t�d� d }|�r tj�|�}t|�}t|�| _t�d|� zt| j�\}}}W n: t�y� } z td|tj|| j� W Y d }~n
d }~0 0 |�r |�s t�d� d }|d u �r*|
�s*t�d� d }n
t�d� t |�o4|�}|�r2t!| jd� t�d� z0t"||�\}}}}|�rv|| _#n| j$�%� | _#W nt t&j'�y� } z td|t(j)|| j� W Y d }~nBd }~0 t*�y� } z td|tj|| j� W Y d }~n
d }~0 0 d| _+|�d� t�,|� t-t.j/t(j0� t!| jd� �n�|�r�d| _1z�t!| jd� t2| j�\}}}t3|�| _1| jj4}t5|tj� | jj6d ��}|�o�| }| jj7}|�r |�r d!}| jj8�r�t�d"� d#}t9t:t;|�} | �
� d#k�r d$}!t�|!� t-t.j<t(j=� t>|!��tj� | j�?d%�d&�}"W n: t*�yR } z td'|tj|| j� W Y d }~n
d }~0 0 |�r�|�r�zt@||�}#|#�A� W n: t*�y� } z td(|tj|| j� W Y d }~n
d }~0 0 z$t�d)� tB| jdd| j$jC�| _#W n: t*�y } z td*|tjD|| j� W Y d }~n
d }~0 0 |�r�t�d+� tE� }$| jjF}%z4| jjG}&|%�sF|&�rX|$�H|%|&| j$� n
t�d,� W n: t*�y� } z td-|tj|| j� W Y d }~n
d }~0 0 |�r�ztI|||"�}'|'�A� W n: t*�y� } z td.|tj|| j� W Y d }~n
d }~0 0 |�rXztJ|tj� | jj6d �� W n: t*�yV } z td/|tj|| j� W Y d }~n
d }~0 0 d| _+|�d� t�,tj�|�� tK| j1� t-t.j/t(j0� t!| jd� nzd0tLfd1tMfg}(d })|(D ]\})}*|*� } | �r� �qq�| �rt
| d�\}}}| | _d2|v �r|d2 �r|d2 | _#|�|)� tN|�d3k�r,dS d4|v �r�|d4 �r�|d4 }+d},| jOD ]}-|+�P|-��rR|-}, �qp�qR|,�s�t�d5|+| � dS tjQ|+d d6�\}.}}t�d7|+� t�R||.g�}|�|+� t�R||g�}d8� |�| _S|| _T|| _U|| _V|| _WdS )9N� �instance-idz iid-dsovf�system-product-namezNo system-product-name found�vmwarez$VMware Virtualization Platform foundFz3Skipping the check for VMware Customization supportZdisable_vmware_customizationT�allow_raw_dataz.Customization for VMware platform is disabled.)z/usr/lib/vmware-toolsz/usr/lib64/vmware-toolsz/usr/lib/open-vm-toolsz/usr/lib64/open-vm-toolsz'/usr/lib/x86_64-linux-gnu/open-vm-toolsz(/usr/lib/aarch64-linux-gnu/open-vm-toolszlibdeployPkgPlugin.soz$Found the customization plugin at %szwaiting for configuration filezcust.cfg)Zlogfunc�msg�func�argsz&Did not find the customization plugin.z,Found VMware Customization Config File at %szFile(s) missing in directoryz)Customization using raw data is disabled.z.Customization using VMware config is disabled.z-Did not find VMware Customization Config FileZStartedz0Start to load cloud-init meta data and user dataz&Error parsing the cloud-init meta dataz&Error loading cloud-init configurationzvmware-toolsZ
Successful�dataZfalsez=Set default value to true due to customization configuration.�truez-Custom script is disabled by VM AdministratorZscriptszper-instancez+Error parsing the customization Config Filez(Error executing pre-customization scriptz#Preparing the Network configurationz%Error preparing Network ConfigurationzApplying password customizationzChanging password is not neededz%Error applying Password Configurationz)Error executing post-customization scriptzError creating marker fileszcom.vmware.guestInfoZiso�network-configr �seedfromz Seed from %s not supported by %s)ZtimeoutzUsing seeded cache data from %s�,)X�get_ovf_envr- r r �
read_dmi_data�LOG�debugr r r �read_ovf_environmentr! �append�lowerr$ r Zget_cfg_option_boolr+ Zds_cfg�search_file�get_max_wait_from_cfgZlog_time�wait_for_imc_cfg_file�dirnamer r r'