Is it possible to ignore version errors?

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
erict
Messages: 56
Registration: December 22, 2017 - 7:09 PM

July 11, 2018 - 09:53

Hello,

I'm using WAPT 1.5 Community.

I have a package that installs an application from an MSI using `install_msi_if_needed`.
It always throws an error in WAPT with the message: "has been installed and the uninstall key found, but version is not good".
Despite various attempts, I haven't been able to fix this error. Ultimately, it doesn't matter much to me, as the software is installed correctly and works properly. However, since another package depends on it, this error prevents the installation of that other package.
Is it possible to tell WAPT, in some way, to ignore this error?
I'm already familiar with the `accept_returncodes` parameter, but in this case, it doesn't seem to be applicable.

for your help.
advance
erict
Messages: 56
Registration: December 22, 2017 - 7:09 PM

July 11, 2018 - 10:23

Just to clarify:

The version number in my config file is exactly the same as the one returned by the command
`get-itemproperty HKLM:\software\wow6432node\microsoft\currentversion\uninstall\uninstall\* | select-object displayname, displayversion`
User avatar
htouvet
WAPT Expert
Messages: 436
Registration: March 16, 2015 - 10:48
Contact :

July 11, 2018 - 11:08

I suspect that one of the versions is on 3 components "1.2.3" and the other on 4 "1.2.3.0"?

You can force the version in the install_msi_if_needed function with the parameter:
get_version: provide a function that returns the currently installed version

Code: Select all

def my_get_version(soft):
    print(u'Version installée: %s' % soft['version'])
    return soft['version']

def install():
    install_msi_if_needed('setup.msi',get_version=my_get_version)
Tranquil IT
erict
Messages: 56
Registration: December 22, 2017 - 7:09 PM

July 11, 2018 - 2:47 PM

htouvet wrote: I suspect that one of the versions is on 3 components "1.2.3" and the other on 4 "1.2.3.0"?
Since the PowerShell command returns exactly the version number I'm using in my control file, I thought not, but I admit I don't know all the intricacies of the Windows world; MSI and such. :(

htouvet wrote:

Code: Select all

def my_get_version(soft):
    print(u'Version installée: %s' % soft['version'])
    return soft['version']
What should I send to this function? (Is the 'soft' variable the software name, its key, the location of the executable after installation...?)

THANKS
AND.
erict
Messages: 56
Registration: December 22, 2017 - 7:09 PM

July 17, 2018 - 2:05 PM

Good morning,

I found a function in the setuphelpers that seemed to answer my question:
get_msi_properties.
So, things became simple:

Code: Select all

def install():
	print ('Installing sentinelRuntime')
	soft = get_msi_properties("Sentinel Runtime.msi")
	install_msi_if_needed('Sentinel Runtime.msi', '/q /norestart', get_version=soft['Version'])
Except now, I'm allowed one error:
Installing Sentinel Runtime
TypeError: 'unicode object is not callable'

And here, I confess, I'm starting to crack a little...

A quick tip for those who haven't thought of it yet for testing setuphelpers in the console:
In a Python console, a simple "import setuphelpers" command works. This saves time when testing your code. ;-)
I know, it's silly, but sometimes we don't think about the simple things and we waste a lot of time...
erict
Messages: 56
Registration: December 22, 2017 - 7:09 PM

July 18, 2018 - 12:22

Good morning,

After multiple tests, errors, corrections... this is where I am.

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *

uninstallkey = []

def get_sentinel_version(soft="Sentinel Runtime.msi"):
    sentiProps = get_msi_properties(soft)
    sentiVers = str(sentiProps['Version'])
    #print('Type de sentiVers : ' type(sentivers))
    return sentiVers

def install():
    print('installing unilim-sentinelRuntime')
    install_msi_if_needed('Sentinel Runtime.msi', '/q /norestart', get_version=get_sentinel_version)
In my previous code, I had an error because get_version was expecting a "callable object" and not a "string", hence the function (I hadn't understood why it was there before).
Now, I'm allowed to make a mistake:
TypeError: MSIOpenDatabase() argument 1 must be string, not dict
I tried using the str() function in my function to fix it, but it didn't work.

I keep sending messages in bottles, hoping that one day, one of them will inspire someone. ;-)

AND.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

July 18, 2018 - 10:56 PM

In your case, the test is not good.

The aim of this maneuver is to tell wapt not to look for the software version in the software's uninstallkey but elsewhere.

get_version is used to tell wapt the version number of the software.

Example using the Naps software:

Code: Select all

       def versnaps2(key):
                return key['name'].replace('NAPS2 ','')

        install_exe_if_needed('naps2-5.3.3-setup.exe',silentflags='/VERYSILENT',key='NAPS2 (Not Another PDF Scanner 2)_is1',get_version=versnaps2)
        
Wapt is instructed to retrieve the version from the software name.

In your code, you are going to retrieve the version number from the msi file which is in the package, this does not make sense.

To resolve your issue, you can also simply modify the min_version by calling install_msi_if... rather than using get_version.

https://github.com/tranquilit/WAPT/blob ... s.py#L3815
erict
Messages: 56
Registration: December 22, 2017 - 7:09 PM

July 21, 2018 - 10:45

Hello,

thank you for your reply.
Actually, I decided to start from scratch, and I no longer have the version conflict problem. It's quite strange; the only difference from my original script is that I didn't specify `silent_options` in the parameters (in fact, `/q` and `/norestart` are already set by default in `install_msi_if_needed`, I noticed this in the code), and so it works.
I can't explain why...

Because of this problem, I lost quite a bit of time, but I gained a lot of knowledge about how WAPT works, through my tests and your replies, which will be very useful to me later.

you.
Thank
Locked