Page 1 of 1

[SOLVED] Update-Upgrade package fusioninventory

Published: April 26, 2018 - 11:33 AM
by maintenancevla
Hello


, I'm writing because I'm having some trouble upgrading my Fusion Inventory package.

I changed GLPI servers as a result, so I updated my Fusion Inventory package to version 2.4.5, but unfortunately, the update isn't working on the client machines. They're still on version 2.4.2, or worse, they show version 2.4.5 but with the error message: "

Installing Fusion Inventory agent.exe
setup fusioninventory-agent_windows-x64_2.4.exe already installed. Skipping".

What steps am I missing?

Thank you in advance.

Re: Update-Upgrade package fusioninventory

Published: April 26, 2018 - 4:25 PM
by htouvet
Hello,
could you please post the contents of your setup.py file?
I think either you haven't updated the uninstallation key or the version if the key is the same regardless of the version

.

Re: Update-Upgrade package fusioninventory

Published: April 27, 2018 - 8:07 AM
by maintenancevla
Here, I even tested it with => min_version='2.4-3'.
For your information, it was also version 2.4 before, so now it's just URL modifications. GLPI server



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

uninstallkey = []


server = "http://XXX.XXX.XXX.XXX/plugins/fusioninventory/"

parameters = '/S /acceptlicense /server="%s" /execmode=service /no-ssl-check /runnow' % (server)

key='FusionInventory-Agent'

def install():

print('installing Fusion inventory agent')
versionpaquet = control['version'].split('-',1)[0]
if iswin64():
install_exe_if_needed("fusioninventory-agent_windows-x64_%s.exe" % packageversion,parameters,key=key,min_version='2.4-3')
else:
install_exe_if_needed("fusioninventory-agent_windows-x86_%s.exe" % packageversion,parameters,key=key,min_version=packageversion)




def update_package():
import BeautifulSoup,requests,re

from waptpackage import PackageEntry
verify=True
pe = PackageEntry()
pe.load_control_from_wapt(os.getcwd())
current_version = pe['version'].split('-',1)[0]
verify=True

url = 'https://github.com/fusioninventory/fusi ... t/releases'

import requests,BeautifulSoup
page = requests.get(url + '/latest',headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'},verify=verify).text
bs = BeautifulSoup.BeautifulSoup(page)

bs_raw_string = str(bs.find('a',{'class':'css-truncate'}).text)

version = bs_raw_string

url64 = url + "/download/" + version + "/fusioninventory-agent_windows-x64_%s.exe" % version
url86 = url + "/download/" + version + "/fusioninventory-agent_windows-x86_%s.exe" % version

filenamex86 = "fusioninventory-agent_windows-x86_%s.exe" % version
filenamex64 = "fusioninventory-agent_windows-x64_%s.exe" % version

if not isfile( filenamex64 ) :
wget( url64 )
if not isfile( filenamex86 ):
wget( url86 )


for fileexe in glob.glob('fusioninventory-agent_windows-x64*.exe'):
if fileexe != filenamex64 :
print('Delete ' + fileexe)
remove_file(fileexe)

for fileexe in glob.glob('fusioninventory-agent_windows-x86*.exe'):
if fileexe != filenamex86 :
print('Delete ' + fileexe)
remove_file(fileexe)

if not isfile(filenamex64):
print('Download ' + url64)
wget(url64,filenamex64)

if not isfile(filenamex86):
print('Download ' + url86)
wget(url86,filenamex86)


if __name__ == '__main__':
update_package()

Re: Update-Upgrade package fusioninventory

Published: April 27, 2018 - 2:19 PM
by htouvet
In the min_version, I see '2.4-3' (with a hyphen... I think '2.4' (with a period) would be more correct).
The Fusion Inventory binary hasn't changed; it's still 2.4 from the publisher, so it's normal that WAPT doesn't reinstall it if it's already the correct version.
However, the parameters have changed, so you would need to:
* increment the package version (in the control file, change from .2.4-0 to 2.4-1, for example).
* force the reinstallation with the new parameters. The install_exe_if_needed function doesn't handle this; this function only checks the uninstallation key and the version registered in the registry, but doesn't remember the parameters used.