I would just use the full version form(2.8.0), even if we aren't going to notify on micro versions. The backend always uses the full version. You can then validate it with a regex(\d+\.\d+\.\d+) to ensure not only is it a string but its in the right form.
Whenever reading data from a remote client and server you should assume the data is bad. It shouldn't matter to MAAS if the version is float(2.8) or str(2.8), the data is the same. Thats why people like strongly typed languages for things like this :)
MAAS should do something like this:
from provisioningserver.utils.version import get_maas_version, get_maas_version_tuple
if version_for_notification > maas_version:
# Show notification
This will work if version is a string or float. Using the existing version code also allows this to work for micro versions(e.g 2.9.1) as well. I did find a bug with get_version_tuple though(LP:1896826) due to the MAAS version containing an epoch now.
I would just use the full version form(2.8.0), even if we aren't going to notify on micro versions. The backend always uses the full version. You can then validate it with a regex(\ d+\.\d+ \.\d+) to ensure not only is it a string but its in the right form.
Whenever reading data from a remote client and server you should assume the data is bad. It shouldn't matter to MAAS if the version is float(2.8) or str(2.8), the data is the same. Thats why people like strongly typed languages for things like this :)
MAAS should do something like this:
from provisioningser ver.utils. version import get_maas_version, get_maas_ version_ tuple
maas_version = get_version_ tuple(get_ maas_version( )) for_notificatio n = get_version_ tuple(str( version) )
version_
if version_ for_notificatio n > maas_version:
# Show notification
This will work if version is a string or float. Using the existing version code also allows this to work for micro versions(e.g 2.9.1) as well. I did find a bug with get_version_tuple though(LP:1896826) due to the MAAS version containing an epoch now.