← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~raharper/cloud-init:ntp-configure-timesyncd-fallback-lp-1686485 into cloud-init:master

 

some small things. i assume you were as much trying to avoid test changes as anything else, but the defaults we have there seem simplistic.

Diff comments:

> diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
> index 31ed64e..0b92a40 100644
> --- a/cloudinit/config/cc_ntp.py
> +++ b/cloudinit/config/cc_ntp.py
> @@ -185,19 +217,25 @@ def write_ntp_config_template(cfg, cloud):
>          'pools': pools,
>      }
>  
> -    template_fn = cloud.get_template_filename('ntp.conf.%s' %
> -                                              (cloud.distro.name))
> +    if template is None:
> +        template = 'ntp.conf.%s' % cloud.distro.name
> +
> +    if target is None:

lets just make this a required variable. and can we name it 'path'?
target is just used other places to mean "root of filesystem".

> +        target = NTP_CONF
> +
> +    template_fn = cloud.get_template_filename(template)
>      if not template_fn:
>          template_fn = cloud.get_template_filename('ntp.conf')
>          if not template_fn:
>              raise RuntimeError(("No template found, "
> -                                "not rendering %s"), NTP_CONF)
> +                                "not rendering %s"), target)
>  
> -    templater.render_to_file(template_fn, NTP_CONF, params)
> +    templater.render_to_file(template_fn, target, params)
>  
>  
> -def reload_ntp(systemd=False):
> -    service = 'ntp'
> +def reload_ntp(systemd=False, service=None):
> +    if service is None:
> +        service = 'ntp'

i think since you change all the callers, just change the signature too.
it requires a service name.

>      if systemd:
>          cmd = ['systemctl', 'reload-or-restart', service]
>      else:


-- 
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/328427
Your team cloud-init commiters is requested to review the proposed merge of ~raharper/cloud-init:ntp-configure-timesyncd-fallback-lp-1686485 into cloud-init:master.


References