← Back to team overview

netplan-developers team mailing list archive

Re: [Merge] ~morphis/netplan/+git/netplan:nm-snap-support into netplan:master

 

Two more issues (one even leads to FTBFS), I'll fix them when applying this to the xenial backport. See bug 1627641.

Diff comments:

> diff --git a/src/netplan b/src/netplan
> index bdef802..40663c8 100755
> --- a/src/netplan
> +++ b/src/netplan
> @@ -67,11 +70,24 @@ def parse_args():
>      return args
>  
>  
> +def is_nm_snap_enabled():
> +    return subprocess.call(['systemctl', '--quiet', 'is-enabled', NM_SNAP_SERVICE_NAME], stderr=subprocess.DEVNULL) == 0
> +
> +
> +def nmcli(args):
> +    binary_name = 'nmcli'
> +
> +    if is_nm_snap_enabled():
> +        binary_name = 'network-manager.nmcli'
> +
> +    subprocess.check_call([binary_name] + args, stderr=subprocess.DEVNULL)

missing stdout redirection

> +
> +
>  def nm_running():  # pragma: nocover (covered in autopkgtest)
>      '''Check if NetworkManager is running'''
>  
>      try:
> -        subprocess.check_call(['nmcli', 'general'], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
> +        nmcli(['general'])
>          return True
>      except (OSError, subprocess.SubprocessError):
>          return False
> @@ -258,8 +285,12 @@ def command_apply():  # pragma: nocover (covered in autopkgtest)
>              # restarting NM does not cause new config to be applied, need to shut down devices first
>              for device in devices:
>                  # ignore failures here -- some/many devices might not be managed by NM
> -                subprocess.call(['nmcli', 'device', 'disconnect', device], stderr=subprocess.DEVNULL)
> -            subprocess.check_call(['systemctl', 'stop', '--no-block', 'NetworkManager.service'])
> +                try:
> +                    nmcli(['device', 'disconnect', device])
> +                except CalledProcessError:

missing "subprocess."

> +                    pass
> +
> +            systemctl_network_manager('stop')
>      else:
>          logging.debug('no netplan generated NM configuration exists')
>  


-- 
https://code.launchpad.net/~morphis/netplan/+git/netplan/+merge/306607
Your team Developers of netplan is subscribed to branch netplan:master.


References