관리-도구
편집 파일: arch.cpython-39.pyc
a ����'�Dg�����������������������@���st���d�dl�Z�d�dlmZmZmZmZ�d�dlmZ�d�dlm Z �d�dl mZ�d�dlm Z mZ�e��e�ZG�dd��dej�ZdS�) �����N)�distros�helpers�subp�util)�PackageList)�HostnameConf)�CLOUDINIT_NETPLAN_FILE)� PER_ALWAYS�PER_INSTANCEc�������������������@���s����e�Zd�ZdZdgZdeddd�iZdd��Zd!d d�Ze d�d d�Z dd��Zdd��Zdd��Z d"dd�Zdd��Zdd��Zd#dd�Zdd�dd �Zd S�)$�Distroz/etc/locale.genZ systemctlZnetplanz# generated by cloud-init T)Znetplan_pathZnetplan_headerZpostcmdsc�����������������C���s0���t�j�|�|||��t�|�|�_d|�_d|d<�d�S�)NZarchZsshdZssh_svcname)r���r����__init__r���ZRunners�_runnerZosfamily)�self�nameZcfg�paths��r����:/usr/lib/python3.9/site-packages/cloudinit/distros/arch.pyr������s����zDistro.__init__Nc�����������������C���sj���|d�ur|dkrt��d|��t���d|�dg}t�|�jd�|���tjdgdd��tjd d |gdd��d�S�)Nz/etc/locale.confzFInvalid locale_configfile %s, only supported value is /etc/locale.confz%s UTF-8��� z locale-genF�ZcaptureZ localectlz set-locale)�LOGZwarningr���Zmake_header� write_file� locale_gen_fn�joinr���)r����localeZout_fn�linesr���r���r����apply_locale&���s������zDistro.apply_locale)�pkglistc�����������������C���s���|������|�jd|d��d�S�)Nr���)�pkgs)�update_package_sources�package_command)r���r���r���r���r����install_packages9���s����zDistro.install_packagesc�����������������C���s|���d�}z|���|�}W�n8�tyJ���t�|�jdd�}|r6nt�d��Y�d�S�Y�n0�|sXtd�}|�|��tj |t |�ddd��d�S�)N�create_hostname_fileTz8create_hostname_file is False; hostname file not createdr����wi���)Zomode�mode)�_read_hostname_conf�IOErrorr���Zget_cfg_option_boolZ_cfgr����infor���Zset_hostnamer����str)r����hostname�filename�confr"���r���r���r����_write_hostname=���s"������ zDistro._write_hostnamec�����������������C���s���|���|�j�}|�j|fS��N)�_read_hostnameZhostname_conf_fn)r���Zsys_hostnamer���r���r����_read_system_hostnameS���s����zDistro._read_system_hostnamec�����������������C���s���t�t�|��}|����|S�r-���)r���r���Zload_text_file�parse)r���r*���r+���r���r���r���r%���W���s����zDistro._read_hostname_confc�����������������C���s8���d�}z|���|�}|j}W�n�ty*���Y�n0�|s4|S�|S�r-���)r%���r)���r&���)r���r*����defaultr)���r+���r���r���r���r.���\���s���� zDistro._read_hostnamec�����������������C���sJ���t��d|��zt�ddd|g��W�n"�tjyD���t�t�d|��Y�n0�d�S�)Nz2Non-persistently setting the system hostname to %sZhostnamectlz--transientzset-hostnamez;Failed to non-persistently adjust the system hostname to %s)r����debugr���ZProcessExecutionErrorr���Zlogexc)r���r)���r���r���r����_apply_hostnamei���s������zDistro._apply_hostnamec�����������������C���s���t�j||��|�d��d�S�)N)�tzZtz_file)r���Zset_etc_timezoneZ _find_tz_file)r���r4���r���r���r����set_timezonev���s����zDistro.set_timezonec�����������������C���s����|d�u�rg�}g�d�}|r.t�|t�r.|�|��n|rFt�|t�rF|�|��|dkrRd}|r`|�|��t�d|�}|�|��tj|dd��d�S�)N)Zpacmanz-Syz--quietz--noconfirmZupgradez-uz%s-%sFr���)� isinstancer(����append�list�extendr���Zexpand_package_listr���)r���Zcommand�argsr����cmdr���r���r���r���r ���y���s���� zDistro.package_commandF)�forcec����������������C���s$���|�j�jd|�jdg|rtntd��d�S�)Nzupdate-sourcesz-y)Zfreq)r ����runr ���r ���r ���)r���r<���r���r���r���r�������s���� �zDistro.update_package_sources)N)N)NN)�__name__� __module__�__qualname__r���Zinit_cmdr���Zrenderer_configsr���r���r���r!���r,���r/���r%���r.���r3���r5���r ���r���r���r���r���r���r������s&����� r���)ZloggingZ cloudinitr���r���r���r���Zcloudinit.distrosr���Z"cloudinit.distros.parsers.hostnamer���Zcloudinit.net.netplanr���Zcloudinit.settingsr ���r ���Z getLoggerr>���r���r���r���r���r���r����<module>���s���