PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  oB]c @sdZddlmZmZddlmZddlmZddlm Z ddlm Z ddlm Z ddlm Z dd l Z dd lZdd lZdd lmZejeZeZd Zd Zd ddddddgZiidd6dd6dgd6dd6dd6d d6d6idd6ed6dgd6dd6d d6d d6d6id!d6ed6d!gd6d!d6d d6d d6d!6id"d6d#d6gd6d$d6d%d6d d6d$6Ziiid&d6d6d6iidd6d6id d6dd6d6id'd6d$6d6iidd6d6id d6dd6d6id'd6d$6d6iid&d6d6d6Zi d(d)6d*d+6d,d-6ed.d/6ed06ed1ed2gd36ed46d5d66iid5d7gd66iid8d66id9d66d:d;6d<6ed=6ed>d/6d?6id8d66id9d66d:d;6d<6ed=6ed@d/6dA6id9d66dBdC6edDd/6dE6idFd66edC6edGd/6dH6iedId/6d5gd66iid9d66edJd/6d6id9d66edKd/6d6id8d66id9d66d<6ed=6edLd/6d6id9d66edMd/6d6id9d66edNd/6d6dO6gdP6dQdR6edS6dT6dO6gdP6edS6d6dO6ZeddddgZ eeZdUZ!dVZ"d ddWZ#d dXZ$dYZ%d d d d d dZZ&ed[Z'd\Z(d]Z)d S(^sNTP: enable and configure ntpi(tget_schema_doctvalidate_cloudconfig_schema(tlog(t PER_INSTANCE(t temp_utils(t templater(t type_utils(tutilN(tdedents /etc/ntp.confitcentostdebiantfedoratopensusetrheltslestubuntutchronydt check_exes/etc/chrony.conftconfpathtchronytpackagest service_nameschrony.conf.{distro}t template_namettemplatetntpdtntpsntp.conf.{distro}tntpdates/lib/systemd/systemd-timesyncds-/etc/systemd/timesyncd.conf.d/cloud-init.confssystemd-timesyncdstimesyncd.confs/etc/chrony/chrony.confs"/usr/lib/systemd/systemd-timesyncdtcc_ntptidtNTPtnamesenable and configure ntpttitles, Handle ntp configuration. If ntp is not installed on the system and ntp configuration is specified, ntp will be installed. If there is a default ntp config file in the image or one is present in the distro's ntp package, it will be copied to ``/etc/ntp.conf.dist`` before any changes are made. A list of ntp pools and ntp servers can be provided under the ``ntp`` config key. If no ntp ``servers`` or ``pools`` are provided, 4 pools will be used in the format ``{0-3}.{distro}.pool.ntp.org``.t descriptiontdistross # Override ntp with chrony configuration on Ubuntu ntp: enabled: true ntp_client: chrony # Uses cloud-init default chrony configuration s # Provide a custom ntp client configuration ntp: enabled: true ntp_client: myntpclient config: confpath: /etc/myntpclient/myntpclient.conf check_exe: myntpclientd packages: - myntpclient service_name: myntpclient template: | ## template:jinja # My NTP Client config {% if pools -%}# pools{% endif %} {% for pool in pools -%} pool {{pool}} iburst {% endfor %} {%- if servers %}# servers {% endif %} {% for server in servers -%} server {{server}} iburst {% endfor %} pools: [0.int.pool.ntp.org, 1.int.pool.ntp.org, ntp.myorg.org] servers: - ntp.server.local - ntp.ubuntu.com - 192.168.23.2texamplest frequencytobjectttypetnulltarraytstringthostnametformattitemst uniqueItemss List of ntp pools. If both pools and servers are empty, 4 default pool servers will be provided of the format ``{0-3}.{distro}.pool.ntp.org``.tpoolss List of ntp servers. If both pools and servers are empty, 4 default pool servers will be provided with the format ``{0-3}.{distro}.pool.ntp.org``.tserverstautotdefaults Name of an NTP client to use to configure system NTP. When unprovided or 'auto' the default client preferred by the distribution will be used. The following built-in client names can be used to override existing configuration defaults: chrony, ntp, ntpdate, systemd-timesyncd.t ntp_clienttbooleans Attempt to enable ntp clients if set to True. If set to False, ntp client will not be configured or installedtenabledsv Configuration settings or overrides for the ``ntp_client`` specified.s The path to where the ``ntp_client`` configuration is written.s The executable name for the ``ntp_client``. For example, ntp service ``check_exe`` is 'ntpd' because it runs the ntpd binary.s List of packages needed to be installed for the selected ``ntp_client``.s The systemd or sysvinit service name used to start and stop the ``ntp_client`` service.sP Inline template allowing users to define their own ``ntp_client`` configuration template. The value must start with '## template:jinja' to enable use of templating support. t propertiestrequiredit minPropertiestadditionalPropertiestconfigcCsGt}tjt}||krCtj|||gdt}n|S(sConstruct 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(tDISTRO_CLIENT_CONFIGtcopytNTP_CLIENT_CONFIGRt mergemanydicttTrue(tdistrotdcfgtcfg((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.pytdistro_ntp_client_configss  "cCst|j}|rA|dkrAtjd||j|iS|jdd}i}|dkrxR|jD]G}|j|}tj|jdrotjd||}PqoqoW|s|jd}tjd||j|}qn"tjd||j|i}|S( s 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. R/s4Selected NTP client "%s" via user-data configurationR1Rs+Selected NTP client "%s", already installedis<Selected distro preferred NTP client "%s", not yet installeds1Selected NTP client "%s" via distro system config( RBRtLOGtdebugtgett get_optiontpreferred_ntp_clientsRtwhich(R1R?t distro_cfgtdistro_ntp_clientt clientcfgtclientRA((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.pytselect_ntp_clients2      cCs9tj|rdS|dkr+dg}n||dS(shInstall ntp client package if not already installed. @param install_func: function. This parameter is invoked with the contents of the packages parameter. @param packages: list. This parameter defaults to ['ntp']. @param check_exe: string. The name of a binary that indicates the package the specified package is already installed. NR(RRHtNone(t install_funcRR((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.pytinstall_ntp_clientLs   cCs-tjj|r)tj||dndS(sRename any existing ntp client config file @param confpath: string. Specify a path to an existing ntp client configuration file. s.distN(tostpathtexistsRtrename(R((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.pytrename_ntp_conf]scCs\g}|}|dkr!d}nx4tdtD]#}d||f}|j|q1W|S(sGenerate a list of server names to populate an ntp client configuration file. @param distro: string. Specify the distro name @returns: list: A list of strings representing ntp servers for this distro. RR is%d.%s.pool.ntp.org(trangetNR_POOL_SERVERStappend(R?tnamest pool_distrotxR((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.pytgenerate_server_namesgs  cCs|sg}n|sg}nt|dkrjt|dkrjt|}tjddj|n|stdn| r| rtdni|d6|d6}|rtjdd d d }|d }tj |d |nt j ||||rtj |ndS(sRender a ntp client configuration for the specified client. @param distro_name: string. The distro class name. @param servers: A list of strings specifying ntp servers. Defaults to empty list. @param pools: A list of strings specifying ntp pools. Defaults to empty list. @param path: A string to specify where to write the rendered template. @param template_fn: A string to specify the template source file. @param template: A string specifying the contents of the template. This content will be written to a temporary file before being used to render the configuration file. @raises: ValueError when path is None. @raises: ValueError when template_fn is None and template is None. is*Adding distro default ntp pool servers: %st,s Invalid value for path parameters$Not template_fn or template providedR.R-tprefixstemplate_name-tsuffixs.tmplitcontentN( tlenR\RCRDtjoint ValueErrorRtmkstempRt write_fileRtrender_to_filetdel_file(t distro_nameR.R-RRt template_fnRtparamsttfile((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.pytwrite_ntp_config_templatezs(  $  cCs>|rdd|g}nd|dg}tj|dtdS(s%Restart or reload an ntp system service. @param service: A string specifying the name of the service to be affected. @param systemd: A boolean indicating if the distro uses systemd, defaults to False. @returns: A tuple of stdout, stderr results from executing the action. t systemctlsreload-or-restarttservicetrestarttcaptureN(RtsubpR>(Rntsystemdtcmd((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.pyt reload_ntpscCsg}tjt|j}|rXdjt|}|jdjd|n4t|j d|j dgs|jdnxBt|j D].\}}d|}|dkrt |t |t jgs|jd jd |d |qq|d krDt |ts|jd jd |d |qq|dkr|dkrbqnt |t js|jdjd |d |qqt |t js|jdjd |d |qqW|rtdjddj|ndS(sOValidate user-provided ntp:config option values. This function supplements flexible jsonschema validation with specific value checks to aid in triage of invalid user-provided configuration. @param ntp_config: Dictionary of configuration value under 'ntp'. @raises: ValueError describing invalid values provided. s, s(Missing required ntp:config keys: {keys}tkeysRRsJEither ntp:config:template or ntp:config:template_name values are requireds ntp:config:Rs6Expected a config file path {keypath}. Found ({value})tkeypathtvalueRsHExpected a list of required package names for {keypath}. Found ({value})s5Expected a string type for {keypath}. Found ({value})s$Invalid ntp configuration:\n{errors}terrorss N(stemplates template_name(tREQUIRED_NTP_CONFIG_KEYSt differencetsetRuRbtsortedRXR*tanyRER+tallt isinstancetsixt string_typestlistRNRc(t ntp_configRxtmissingRutkeyRwRv((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.pytsupplemental_schema_validationsH            c CsSd|kr tjd|dS|d}|dkr?i}nt|tsrtdjdtj|nt |t |j dt }t j|rtjd|dSt|j d|j}t j||j d igd t }t|td |j d d}|j d s|j d jd|jj} |j| }|sd|j d } t| qnt|jjd|j dgd|j dgd|j d d|d |j d t|jjd|dd|dy!t|dd|jjWn)t jk rN} tjd| nXdS(sEnable and configure ntp.Rs8Skipping module named %s, not present or disabled by cfgNsL'ntp' key existed in config, but not a dictionary type, is a {_type} insteadt_typeR3s)Skipping module named %s, disabled by cfgR1R8R9RRRs{distro}s#No template found, not rendering %sR.R-RRRiRRRRrs&Failed to reload/start ntp service: %s(RCRDRNRtdictt RuntimeErrorR*Rtobj_nameRtschemaRER>Rtis_falseRMR?R=RRUtreplaceRtget_template_filenameRlRPtinstall_packagesRtt uses_systemdtProcessExecutionErrort exception( RRAtcloudRt_argstntp_cfgR3tntp_client_configRiRtmsgte((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.pythandles\        !    (*t__doc__tcloudinit.config.schemaRRt cloudinitRtloggingtcloudinit.settingsRRRRRR;RQRttextwrapRt getLoggert__name__RCR#tNTP_CONFRWR!RNR<R:R>tFalseRt frozensetRyRBRMRPRUR\RlRtRR(((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.pyts:                         - -  2