x[hK0UdZddlZddlZddlZddlmZmZddlmZm Z m Z m Z m Z ddl mZddlmZddlmZddlmZej*eZeZd Zd Zgd Zd d dgdddddedgdddddedgddddddgddddddgdddddZdd dd gddddd d!d"id#d id d!d"d$d#did#d id%dd dd&idd'diid ddd(d)dgd dd*d+d,d-gd-d.d/d0d#d id d!d"d$d-iid#d id ddd1did2d#d id ddd1d id2d#d idd d&d d!d"d2d#did#d id%d#d id ddd1d id2dd'diid3Zeeefed4<d5D] Z ed6ee < d7D] Z ed8ee < d9D] Z ed:ee < d;eedgd<Z!eed=<e"gd>Z#d?Z$d@efdAZ%dLdBZ&dMdCZ'dDZ( dNdEZ)dFZ*dGedHedIedJe+d@df dKZ,y)OzNTP: enable and configure ntpN)DictMapping)subp temp_utils templater type_utilsutil)Cloud)Config) MetaSchema) PER_INSTANCEz /etc/ntp.conf) almalinuxalpineaosc azurelinuxcentos cloudlinuxcosdebian eurolinuxfedorafreebsdmariner miraclelinuxopenbsd openeuler OpenCloudOS openmandrivaopensuseopensuse-microosopensuse-tumbleweed opensuse-leapphotonrhelrockysle_hpc sle-microsles TencentOSubuntu virtuozzochronydz/etc/chrony.confchronyzchrony.conf.{distro}) check_execonfpathpackages service_name template_nametemplatentpdntpzntp.conf.{distro}ntpdatez/etc/ntpd.confzntpd.conf.{distro}z/lib/systemd/systemd-timesyncdz-/etc/systemd/timesyncd.conf.d/cloud-init.confsystemd-timesyncdztimesyncd.conf)r.r6r7openntpdr8z/etc/chrony/chrony.conf)r0r2)r0r1r2)r.r6z"/usr/lib/systemd/systemd-timesyncdz/etc/systemd/timesyncd.conf)r/r0r2)r.r8)r6r.)r2r0r0)r0r2r3z/usr/local/etc/chrony.conf)r0r1r2r3z/usr/local/sbin/ntpdz/usr/local/etc/ntp.confr9zntpd.conf.openbsd)r/r0r1r2r3)r6r.r9r/)r.r6r8)rrrrrrrrrrr r$r%r)r+DISTRO_CLIENT_CONFIG)r!r"r#r )rrr&r%)r'r(r)cc_ntp)iddistros frequencyactivate_by_schema_keysmeta)r/r0r1r2ct}tjt}||vrtj|||gd}|S)zConstruct a distro-specific ntp client config dictionary by merging distro specific changes into base config. @param distro: String providing the distro class name. @returns: Dict of distro configurations for ntp clients. Treverse)r:copyNTP_CLIENT_CONFIGr mergemanydict)distrodcfgcfgs 9/usr/lib/python3/dist-packages/cloudinit/config/cc_ntp.pydistro_ntp_client_configsrK s? D ))% &C ~  #tF|!4dC JreturncFt|j}|r-|dk7r(tjd||j |iS|j dd}i}|dk(r|j D]Q}|j |}tj|j ds9tjd||}n|s7|j d}tjd||j |i}|Stjd||j |i}|S) a Determine which ntp client is to be used, consulting the distro for its preference. @param ntp_client: String name of the ntp client to use. @param distro: Distro class instance. @returns: Dict of the selected ntp client or {} if none selected. autoz4Selected NTP client "%s" via user-data configuration ntp_clientr/z+Selected NTP client "%s", already installedrz?K   ,)/:BB  )) 11-@ 5#''89 s# #II "3"7"7"GHIImW[[B78IIk7;;w34IIk7;;w34IIk7;;w34 &**>: Ir*kk'2&kk'2&kk'2&  " ": ."&&z2  %%":.#K0  {{}   0F : @ ++FF; C ++Iv>  LL ' '+N;   ## '7 -- @ >? @-- C AB C))  MMB sT&N O O<P. (O  O (O98O9<P+P&&P+.QQQ)Nr5)N)NNNNNNNN)-__doc__rDloggingratypingrr cloudinitrrrrr cloudinit.cloudr cloudinit.configr cloudinit.config.schemar cloudinit.settingsr getLogger__name__rRr>NTP_CONFrkr=rEr:rn__annotations__rGr@ frozensetrrKr\r_rfrsrrrrrLrJrs$  CC!#.+g!   F&J / G,  K!, $- 6C+) C)^2% ("  =5   I >5  F  I  %1    1 ("0 5! %3  01# &0  , I >5  B I (" 9   I (" =   I !'OD=5  F  I   I (" =    1 II)d39oIVKDF#7 #C D3@F#7#? @'@F#7#? @  %w j%9 /W/d"2>      J#Z: z__6_%_t__rL