I am using jinja2 template to install/upgrade packages.
The logic was setting a variable for current installed version and compare it with the available version. It was working fine but once we passed in to 10.x, comparison quit working.
Is it possible to cast the variable so it can correctly identify 10.9.8 is greater than 9.8.7?
Thanks
current_version=['9.8.7']
{% if current_version < '10.9.8' %}
There's a special test version_compare:
{% if current_version | version_compare('10.9.8', '<') %}
current_version
should be string (it is a list in your example).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With