← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~larsks/cloud-init:bz/1542578 into cloud-init:master

 

Thats my first quick pass.
This code is really in need of re-factoring.

And could really use unit tests.


Diff comments:

> diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
> index f14a4fc..c0d5029 100644
> --- a/cloudinit/config/cc_mounts.py
> +++ b/cloudinit/config/cc_mounts.py
> @@ -336,12 +352,17 @@ def handle(_name, cfg, cloud, log, _args):
>  
>          start = str(cfgmnt[i][0])
>          sanitized = sanitize_devname(start, cloud.device_name_to_device, log)
> +        if sanitized != start:
> +            log.debug("changed %s => %s" % (start, sanitized))
> +
>          if sanitized is None:
> -            log.debug("Ignorming nonexistant named mount %s", start)
> +            log.debug("Ignoring nonexistant named mount %s", start)
> +            continue
> +        elif sanitized in fstab_devs:
> +            log.warn("Device %s already defined in fstab: %s",
> +                     sanitized, fstab_devs[sanitized])

lets call this INFO. it doesn't seem like WARN as nothing is actually wrong.

>              continue
>  
> -        if sanitized != start:
> -            log.debug("changed %s => %s" % (start, sanitized))
>          cfgmnt[i][0] = sanitized
>  
>          # in case the user did not quote a field (likely fs-freq, fs_passno)
> @@ -373,11 +394,17 @@ def handle(_name, cfg, cloud, log, _args):
>      for defmnt in defmnts:
>          start = defmnt[0]
>          sanitized = sanitize_devname(start, cloud.device_name_to_device, log)
> +        if sanitized != start:
> +            log.debug("changed default device %s => %s" % (start, sanitized))
> +
>          if sanitized is None:
>              log.debug("Ignoring nonexistant default named mount %s", start)
>              continue
> -        if sanitized != start:
> -            log.debug("changed default device %s => %s" % (start, sanitized))
> +        elif sanitized in fstab_devs:
> +            log.warn("Device %s already defined in fstab: %s",
> +                     sanitized, fstab_devs[sanitized])

same here.. this one seems even less important. maybe DEBUG here ?

> +            continue
> +
>          defmnt[0] = sanitized
>  
>          cfgmnt_has = False


-- 
https://code.launchpad.net/~larsks/cloud-init/+git/cloud-init/+merge/345113
Your team cloud-init commiters is requested to review the proposed merge of ~larsks/cloud-init:bz/1542578 into cloud-init:master.


References