Page 1 of 1

[SOLVED] Firefox ESR 32bit/64bit Update Package

Published: April 20, 2018 - 10:07 PM
by erwan35
Hello everyone,

I'm new to WAPT and I need your help.

I want to update Firefox ESR 52.7.2 to 52.7.3 on the network, but only if that version is already installed on the PC.
The `install_exe_if_needed` function doesn't meet my needs.

I have several PCs:
- Windows 7 32-bit with Firefox ESR 52.7.2 32-bit , which I would like to update to Firefox ESR 52.7.3 32-bit
- Windows 7 64-bit with Firefox ESR 52.7.2 32-bit (due to compatibility issues with some applications), which I would like to update to Firefox ESR 52.7.3 32-bit
- Windows 7 and 10 64-bit with Firefox ESR 52.7.2 64-bit , which I would like to update to Firefox ESR 52.7.3 64-bit.

How can I retrieve the version of Firefox ESR installed on the PC (which wasn't installed by wapt)? Is there a Python function that can retrieve this information?
How can I create this package in Python?

Re: Package Maj Firefox ESR 32bits/64bits

Published: April 23, 2018 - 12:22 PM
by dcardon
Please specify your WAPT version and server OS.

Re: Package Maj Firefox ESR 32bits/64bits

Published: April 23, 2018 - 1:14 PM
by erwan35
dcardon wrote: Apr 23, 2018 - 12:22 Please indicate your WAPT version and server OS.
WAPT Server version: 1.5.1.23
WAPT Agent version: 1.5.1.23
WAPT Deploy version: 1.5.1.23
OS: Windows 2012 R2 64-bit

So, I managed to retrieve the Firefox version with:

Code: Select all

for soft in installed_softwares('Firefox')
The command installed_softwares('Firefox') returns this:

Code: Select all

[{'install_date': '',
  'install_location': u'C:\\Program Files\\Mozilla Firefox',
  'key': u'Mozilla Firefox 52.7.2 ESR (x64 fr)',
  'name': u'Mozilla Firefox 52.7.2 ESR (x64 fr)',
  'publisher': u'Mozilla',
  'system_component': 0,
  'uninstall_string': u'"C:\\Program Files\\Mozilla Firefox\\uninstall\\helper.exe"',
  'version': u'52.7.2'}]
How can we remove the u'...' from the variable soft(name) which refers u'Mozilla Firefox 52.7.2 ESR (x64 fr)'?

Re: Package Maj Firefox ESR 32bits/64bits

Published: April 23, 2018 - 11:17 PM
by htouvet

Code: Select all

def install():
    for soft in installed_softwares('Firefox'):
        nom_firefox = soft['name']
        print(u"Le firefox installé est: %s" % nom_firefox)
More directly:
installed_softwares('Firefox')[0]['name']

installed_software() returns a list (recognizable by the brackets), we take the first element hence the [0].
Each element of the list is a "dictionary" (recognizable by its representation with curly braces). The key "name" is extracted from this dictionary using ['name'].

Illustration:

Code: Select all

def install():
    print(installed_softwares('Firefox'))
    print(installed_softwares('Firefox')[0])
    print(installed_softwares('Firefox')[0]['name'])
The "u"" indicates that the string is of "unicode" type (not ASCII, but it handles accented characters and Chinese characters, for example). This is a debugging representation, but the string itself does not contain this "u" or apostrophes.