%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core22/2082/lib/python3/dist-packages/cloudinit/distros/__pycache__/
Upload File :
Create Path :
Current File : //snap/core22/2082/lib/python3/dist-packages/cloudinit/distros/__pycache__/photon.cpython-310.pyc

o

 Nhn�@slddlZddlmZmZmZmZmZddlmZddlm	Z
ddlmZm
Z
e�e�ZGdd�dej�ZdS)�N)�distros�helpers�net�subp�util)�PackageList)�	rhel_util)�
PER_ALWAYS�PER_INSTANCEc@s�eZdZdZdZdZdZdeed�iZdZdd	�Z	d$d
d�Z
dd
�Zd%dd�Zde
fdd�Zdd�Zdd�Zd%dd�Zdd�Zdd�Zd&dd�Zd d!�d"d#�ZdS)'�Distroz
/etc/hostnamez/etc/systemd/network/z/etc/locale.confz/etc/systemd/resolved.conf�networkd)�resolv_conf_fn�network_conf_dirTcCs0tj�||||�t�|�|_d|_dg|_dS)N�photon�	systemctl)rr�__init__r�Runners�_runner�osfamily�init_cmd)�self�name�cfg�paths�r�:/usr/lib/python3/dist-packages/cloudinit/distros/photon.pyrszDistro.__init__cCsnt�d|�ztj||d�\}}|rt�d||�d||fWSd||fWStjy6t�td|�YdSw)NzAttempting to run: %s)�capturez(Running %s resulted in stderr output: %sTFzCommand %s failed)TNN)�LOG�debugr�warning�ProcessExecutionErrorr�logexc)r�cmdr�out�errrrr�exec_cmd(s��zDistro.exec_cmdcCs:d}|j�|d�}t�d||�|st��St�d�dS)N�disable_fallback_netcfgTz%s value is: %szJSkipping generate_fallback_config. Rely on PhotonOS default network config)�_cfg�getrrr�generate_fallback_config�info)r�keyr&rrrr)6s�zDistro.generate_fallback_configNcCs4|s|j}d|i}t�||�gd�}|�|�dS)N�LANG)r�restartzsystemd-localed)�systemd_locale_conf_fn�rhutil�update_sysconfig_filer%)r�locale�out_fn�
locale_cfgr"rrr�apply_localeDs�zDistro.apply_locale�pkglistcCs|jd|d�dS)N�install)�pkgs)�package_command)rr5rrr�install_packagesVszDistro.install_packagescCs�|r|�d�rt�||�dSd}t�|jdd�}|r)|�ddt|�g�\}}}n|�dddt|�g�\}}}t�d�|rHt�	d||f�dSdS)	N�/previous-hostname�create_hostname_fileT�hostnamectlzset-hostnamez--transientz7create_hostname_file is False; hostname set transientlyz3Error while setting hostname: %s
Given hostname: %s)
�endswithr�
write_file�get_cfg_option_boolr'r%�strrr*r)r�hostname�filename�retr;�_outr$rrr�_write_hostnameZs8���
�����zDistro._write_hostnamecCs|�|j�}|j|fS�N)�_read_hostname�systemd_hostname_conf_fn)r�sys_hostnamerrr�_read_system_hostname{s
zDistro._read_system_hostnamecCs@|r|�d�rt�|���S|�ddg�\}}}|r|��S|S)Nr:rAz-f)r=r�load_text_file�stripr%)rrB�default�_retr#�_errrrrrGszDistro._read_hostnamecCsdS)Nz	127.0.1.1r)rrrr�_get_localhost_ip�szDistro._get_localhost_ipcCstj||�|�d�dS)N)�tz�tz_file)r�set_etc_timezone�
_find_tz_file)rrQrrr�set_timezone�szDistro.set_timezonec	Cs�|sg}ddg}|rt|t�r|�|�n|r!t|t�r!|�|�|�|�t�d|�}|�|�|�|�\}}}|rCt�	d|�dSdS)N�tdnfz-yz%s-%sz#Error while installing packages: %s)
�
isinstancer@�append�list�extendr�expand_package_listr%r�error)	r�command�argsr7r"r5rCrDr$rrrr8�s


�zDistro.package_commandF)�forcecCs$|jjd|jdg|rtntd�dS)Nzupdate-sources�	makecache)�freq)r�runr8r	r
)rr_rrr�update_package_sources�s

�zDistro.update_package_sources)TrF)NN)�__name__�
__module__�__qualname__rHrr.�resolve_conf_fn�renderer_configs�prefer_fqdnrr%r)r4rr9rErJrGrPrUr8rcrrrrrs.��
	
!

r)�logging�	cloudinitrrrrr�cloudinit.distrosrrr/�cloudinit.settingsr	r
�	getLoggerrdrrrrrr�<module>s


Zerion Mini Shell 1.0