name : arch.cpython-39.opt-1.pyc
a

'�Dg��@stddlZddlmZmZmZmZddlmZddlm	Z	ddl
mZddlm
Z
mZe�e�ZGdd�dej�ZdS)	�N)�distros�helpers�subp�util)�PackageList)�HostnameConf)�CLOUDINIT_NETPLAN_FILE)�
PER_ALWAYS�PER_INSTANCEc@s�eZdZdZdgZdeddd�iZdd�Zd!d
d�Ze	d�d
d�Z
dd�Zdd�Zdd�Z
d"dd�Zdd�Zdd�Zd#dd�Zdd�dd �Zd	S)$�Distroz/etc/locale.genZ	systemctlZnetplanz# generated by cloud-init
T)Znetplan_pathZnetplan_headerZpostcmdscCs0tj�||||�t�|�|_d|_d|d<dS)NZarchZsshdZssh_svcname)rr�__init__rZRunners�_runnerZosfamily)�self�nameZcfg�paths�r�:/usr/lib/python3.9/site-packages/cloudinit/distros/arch.pyrszDistro.__init__NcCsj|dur|dkrt�d|�t��d|dg}t�|jd�|��tjdgdd�tjd	d
|gdd�dS)Nz/etc/locale.confzFInvalid locale_configfile %s, only supported value is /etc/locale.confz%s UTF-8��
z
locale-genF�ZcaptureZ	localectlz
set-locale)�LOGZwarningrZmake_header�
write_file�
locale_gen_fn�joinr)r�localeZout_fn�linesrrr�apply_locale&s��zDistro.apply_locale)�pkglistcCs|��|jd|d�dS)Nr)�pkgs)�update_package_sources�package_command)rrrrr�install_packages9szDistro.install_packagescCs|d}z|�|�}Wn8tyJt�|jdd�}|r6nt�d�YdSYn0|sXtd�}|�|�tj	|t
|�ddd�dS)N�create_hostname_fileTz8create_hostname_file is False; hostname file not createdr�wi�)Zomode�mode)�_read_hostname_conf�IOErrorrZget_cfg_option_boolZ_cfgr�inforZset_hostnamer�str)r�hostname�filename�confr"rrr�_write_hostname=s"��
zDistro._write_hostnamecCs|�|j�}|j|fS�N)�_read_hostnameZhostname_conf_fn)rZsys_hostnamerrr�_read_system_hostnameSszDistro._read_system_hostnamecCstt�|��}|��|Sr-)rrZload_text_file�parse)rr*r+rrrr%WszDistro._read_hostname_confcCs8d}z|�|�}|j}Wnty*Yn0|s4|S|Sr-)r%r)r&)rr*�defaultr)r+rrrr.\s

zDistro._read_hostnamecCsJt�d|�zt�ddd|g�Wn"tjyDt�td|�Yn0dS)Nz2Non-persistently setting the system hostname to %sZhostnamectlz--transientzset-hostnamez;Failed to non-persistently adjust the system hostname to %s)r�debugrZProcessExecutionErrorrZlogexc)rr)rrr�_apply_hostnameis��zDistro._apply_hostnamecCstj||�|�d�dS)N)�tzZtz_file)rZset_etc_timezoneZ
_find_tz_file)rr4rrr�set_timezonevszDistro.set_timezonecCs�|durg}gd�}|r.t|t�r.|�|�n|rFt|t�rF|�|�|dkrRd}|r`|�|�t�d|�}|�|�tj|dd�dS)N)Zpacmanz-Syz--quietz--noconfirmZupgradez-uz%s-%sFr)�
isinstancer(�append�list�extendrZexpand_package_listr)rZcommand�argsr�cmdrrrrr ys


zDistro.package_commandF)�forcecCs$|jjd|jdg|rtntd�dS)Nzupdate-sourcesz-y)Zfreq)r
�runr r	r
)rr<rrrr�s
�zDistro.update_package_sources)N)N)NN)�__name__�
__module__�__qualname__rZinit_cmdrZrenderer_configsrrrr!r,r/r%r.r3r5r rrrrrrs&��	




r)ZloggingZ	cloudinitrrrrZcloudinit.distrosrZ"cloudinit.distros.parsers.hostnamerZcloudinit.net.netplanrZcloudinit.settingsr	r
Z	getLoggerr>rrrrrr�<module>s


© 2025 Cubjrnet7