[SOLVED] version in registry does not match requirements of min_version

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
cefinformatique
Messages: 31
Registration: May 26, 2023 - 2:25 p.m.

January 3, 2024 - 1:54 PM

Good morning,

I created a package to deploy software (already installed on client machines) version 23.1.0.4

Here is the setup.py file for my package:

Code: Select all

def install():
    softname ='AWCLIENTSQL'
    listAW=installed_softwares(softname)
    if listAW == softname:
        print("Mise a jour de DiaClientSQL")
        install_exe_if_needed('DiaClientSQLInstall.exe',
            silentflags='/Silent',
            key='AWCLIENTSQL',
            remove_old_version=True
        )
    else:
        print("Mise a jour de DiaClientSQL")
        install_exe_if_needed('DiaClientSQLInstall.exe',
            silentflags='/Silent',
            key='AWCLIENTSQL'
        )
        filecopyto(r'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ACDSuite\DiaClient SQL.lnk',r'C:\Users\Public\Desktop')
Once the package is deployed, I get the following error in 80% of cases:
waptutils.EWaptSetupException: Fatal error: Setup DiaClientSQLInstall.exe has been executed and key AWCLIENTSQL has been found in the registry, but version in registry does not match requirements of min_version=23.1.0.4

EWaptSetupException: Fatal error: Setup DiaClientSQLInstall.exe has been executed and key AWCLIENTSQL has been found in the registry, but version in registry does not match requirements of min_version=23.1.0.4
If I manually restart the update, it will eventually apply correctly after several attempts.

The version installed before the update via WAPT was 23.1.0.2

What can I do to avoid this problem?
Last edited by cefinformatique on 14 Feb 2024 - 14:35, edited 2 times.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

January 3, 2024 - 3:24 PM

No min_version argument is passed to install_exe_if_needed

So the function does this:

Code: Select all

if min_version is None:
    min_version = get_product_props(exe)['version']
And retrieves the version number specified in the file properties.

In your case, it probably isn't good

The best approach would be to add a min_version argument with the version number associated with the AWCLIENTSQL key
cefinformatique
Messages: 31
Registration: May 26, 2023 - 2:25 p.m.

February 13, 2024 - 1:36 PM

Hello,

I'm reopening this topic because, during a recent software update, I correctly entered the "min_version" value, but this didn't resolve the issue.

I've found the cause: During program installation, the old version isn't uninstalled. Because the installation returns an error code of 0 before updating the version number in the Windows registry, the WAPT package compares its version number with the old number still stored in the registry.

Therefore, I need to make the WAPT package wait (approximately 20 seconds) at the stage between the end of the installation and the version number check in the registry to resolve this problem.

Is this possible?
cefinformatique
Messages: 31
Registration: May 26, 2023 - 2:25 p.m.

February 14, 2024 - 2:34 PM

I solved my problem by using the WinReg module to delete the software's registry key before installation. It's a bit of a hack, but it works!

Code: Select all

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

r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

"""
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
uninstallkey = ['AWCLIENTSQL']

def install():
    killalltasks(control.get_impacted_process_list())
    softname ='AWCLIENTSQL'
    listFULL=installed_softwares(softname)
    listAW=listFULL[0]['key']
    if listAW == softname:
        # Define the registry key path
        key_path = r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
        # Open the registry key for deletion
        try:
            with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key_path, 0, winreg.KEY_ALL_ACCESS) as registry_key:
                winreg.DeleteKey(registry_key, "AWCLIENTSQL")
                print("Registry key deleted successfully.")
        except FileNotFoundError:
            print("Registry key not found.")
        except PermissionError:
            print("Permission error. Run the script with administrative privileges.")
        except Exception as e:
            print(f"An error occurred: {e}")
        print("Mise a jour de DiaClientSQL")
        install_exe_if_needed('DiaClientSQLInstall.exe',
            silentflags='/Silent',
            key=softname,
            remove_old_version=True,
#            min_version=control.get_version()
        )
    else:
        print("Installation de DiaClientSQL")
        install_exe_if_needed('DiaClientSQLInstall.exe',
            silentflags='/Silent',
            key=softname,
            remove_old_version=True
        )
        filecopyto(r'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ACDSuite\DiaClient SQL.lnk',r'C:\Users\Public\Desktop')
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

February 15, 2024 - 4:25 PM

Hi Marc,

thanks for the feedback!

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked