netplan needs version numbering

Bug #1987147 reported by Gordon Harris
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Netplan
Opinion
Undecided
Unassigned

Bug Description

If you're going to deprecate formerly good features (e.g. gateway4:) then netplan should have and be able to output a version number so we can determine the syntax to use.

e.g.:

netplan --version

..should return something.

Revision history for this message
Lukas Märdian (slyon) wrote :

The netplan version information was explicitly removed a long time ago (2019) in favor of feature flags:
https://github.com/canonical/netplan/commit/9ea105bef2cea28916213aad93a37ea85d89fdbc

The gateway4: field is still kept around for compatibility reasons (deprecated, though), especially on stable releases.

You can still use your package manager to check netplan's package version, e.g.:
apt show netplan.io

Changed in netplan:
status: New → Opinion
Revision history for this message
Gordon Harris (wgordonharris) wrote :

Thanks for that.

So, Re use feature flags:

NETPLAN_USE_ROUTES="$(netplan info | grep -c default-routes)"

And, Re use package manage to check netplan's package version:

NETPLAN_VER="$(dpkg-query --showformat='${Version}\n' --show 'netplan.io' | sed -e 's/-.*$//')"

Revision history for this message
Adam Collard (adam-collard) wrote (last edit ):

We need something like `--version` as a cheap command to run to see if netplan is installed in any given environment

--version, like --help is a GNU standard:

https://www.gnu.org/prep/standards/html_node/Command_002dLine-Interfaces.html

It is inappropriate to use it for feature detection, which `netplan info` handles just fine.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.