Page 1 of 1

[SOLVED] Version issue

Published: October 20, 2019 - 8:30 PM
by Mathieu
WAPT 1.7.4.6165 Enterprise
- Debian 9.9

Good morning,

I'm working on a package that will install the BIOS.

I'm conducting an audit:

Code: Select all

Bios = registry_readstring(HKEY_LOCAL_MACHINE, r'HARDWARE\\DESCRIPTION\\System\BIOS','BIOSVersion')
System = registry_readstring(HKEY_LOCAL_MACHINE, r'HARdWARE\\DESCRIPTION\\System\BIOS','SystemProductName')
VerBIOS = '1.12.1'

def audit():
    if Bios < VerBIOS and System == "VMware Virtual Platform":
        print ('BIOS a mettre a jour ')
        return 'WARNING'
    if Bios > VerBIOS and System == "VMware Virtual Platform":
        print ('Version du package obsoléte, Package à mettre à jour')
        return 'WARNING'
    if Bios == VerBIOS and System == "VMware Virtual Platform":
        print ('Version du BIOS a Jour')
        return 'OK'
    if System != "VMware Virtual Platform":
        print ('Pas le bon systeme')
        raise EWaptSetupException('Fatal error : %s' %  (''.join("Pas le bon systeme ")))
I am experiencing a problem on a machine; the current BIOS version is 1.6.5.

The new version is 1.12.1

During my audit, the result is the 2nd if statement when it should be the 1st.

After checking in the console when I sort the BIOS versions in ascending order, 1.6.5 is greater than 1.12.1.

I wanted to know how to correct the problem and understand why 1.6.5 is greater than 1.12.1

I thought about adding a 0 in front of the 6 which would work but that would mean changing a lot of posts because it's not the only model to have this problem.

Re: Version problem

Published: October 20, 2019 - 11:22 PM
by sfonteneau
Hi Mathieu,

when you compare versions you need to use the Version class.

Example:

https://www.wapt.fr/fr/doc/wapt-create- ... g-software

Re: [SOLVED] Version issue

Published: October 23, 2019 - 9:28 PM
by Mathieu
Thank you

, I spent hours on something so simple ^^

I learn something new every day

Re: [SOLVED] Version issue

Published: October 23, 2019 - 9:58 PM
by vcardon
Mathieu wrote: Oct 23, 2019 - 9:28 PM Thank you

, I spent hours on something so simple ^^

I learn something new every day
Hi Matthieu

Futuroscope has a packaging contract (... I think because I don't have the management tools at hand), call the office, get answers quickly and then take part of the time you saved to disseminate what you learned with the list, your gain in experience deserves to be shared if it is not confidential.

Those with contracts are those who, a priori, will want to save time and gain certainty. This is the core of Tranquil IT's business model.

A++

VC

Re: [SOLVED] Version issue

Published: October 24, 2019 - 12:15 PM
by Mathieu
Yeah, I don't usually think about it, but I'm the type to search and try things out, and if I get really stuck, I'll look into it.


Also, if there's a place to post creations, no problem, I can share them.