fSddlZddlmZmZmZmZddlmZddlm Z ddl m Z ddl m Z ejeZGddej"Zy) N)distroshelperssubputil) PackageList) HostnameConf)CLOUDINIT_NETPLAN_FILE) PER_INSTANCEcteZdZdZdgZdedddiZdZdd Zd e fd Z d Z d Z dZ ddZdZdZddZdZy)Distroz/etc/locale.gen systemctlnetplanz# generated by cloud-init T) netplan_pathnetplan_headerpostcmdsctjj||||tj||_d|_d|d<y)Narchsshd ssh_svcname)rr __init__rRunners_runnerosfamily)selfnamecfgpathss 8/usr/lib/python3/dist-packages/cloudinit/distros/arch.pyrzDistro.__init__s=dC7u-  #MNc4||dk7rtjd|tjd|zdg}tj|j dj |tjdgdtjd d |gdy) Nz/etc/locale.confzFInvalid locale_configfile %s, only supported value is /etc/locale.confz%s UTF-8 z locale-genFcapture localectlz set-locale)LOGwarningr make_header write_file locale_gen_fnjoinr)rlocaleout_fnliness r apply_localezDistro.apply_locale&s  &,>"> KK,      & !    **DIIe,<= <.%0 ; f5uErpkglistcJ|j|jd|y)Nr!)pkgs)update_package_sourcespackage_command)rr0s rinstall_packageszDistro.install_packages9s! ##% Rg.rc@d} |j|}|s td}|j|tj|t|ddy#t$r>tj|jdd}|rnt j dYyYwxYw)Ncreate_hostname_fileTz8create_hostname_file is False; hostname file not createdr!wi)omodemode) _read_hostname_confIOErrorrget_cfg_option_bool_cfgr&infor set_hostnamer)str)rhostnamefilenameconfr7s r_write_hostnamezDistro._write_hostname=s ++H5D#D (# #d)3UC #'#;#; 14$ $N  sAABBcT|j|j}|j|fSN)_read_hostnamehostname_conf_fn)r sys_hostnames r_read_system_hostnamezDistro._read_system_hostnameSs)**4+@+@A %%|44rcbttj|}|j|SrG)rrload_text_fileparse)rrCrDs rr;zDistro._read_hostname_confWs%D//9:  rcld} |j|}|j}|s|S|S#t$rYwxYwrG)r;rBr<)rrCdefaultrBrDs rrHzDistro._read_hostname\sH ++H5D}}HN    s ' 33ctjd| tjddd|gy#tj$rt j td|YywxYw)Nz2Non-persistently setting the system hostname to %s hostnamectlz --transientz set-hostnamez;Failed to non-persistently adjust the system hostname to %s)r&debugrProcessExecutionErrorrlogexc)rrBs r_apply_hostnamezDistro._apply_hostnameisW @(   II}m^XN O))  KKM  s2.A#"A#cPtj||j|y)N)tztz_file)rset_etc_timezone _find_tz_file)rrXs r set_timezonezDistro.set_timezonevs  B0B0B20FGrcR|g}gd}|r"t|tr|j|n#|r!t|tr|j ||dk(rd}|r|j|t j d|}|j |tj|dy)N)pacmanz-Syz--quietz --noconfirmupgradez-uz%s-%sFr#) isinstancerAappendlistextendrexpand_package_listr)rcommandargsr2cmdr0s rr4zDistro.package_commandys <D9 JtS) JJt  jt, JJt  i G  JJw **7D9 7 #u%rc`|jjd|jdgty)Nzupdate-sourcesz-y)freq)rrunr4r )rs rr3zDistro.update_package_sourcess*  d22TF  rrG)NN)__name__ __module__ __qualname__r*init_cmdr renderer_configsrr/rr5rErKr;rHrVr\r4r3rrr r sh%M}H2; $F&/ /D,5  H&. rr )logging cloudinitrrrrcloudinit.distrosr"cloudinit.distros.parsers.hostnamercloudinit.net.netplanr cloudinit.settingsr getLoggerrkr&r rprrrxs@22);8+g!A W^^A r