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

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
erwan35
Messages: 8
Registration: Apr 05, 2018 - 5:59 p.m.

April 20, 2018 - 10:07 PM

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?
User avatar
dcardon
WAPT Expert
Messages: 1930
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

April 23, 2018 - 12:22

Please specify your WAPT version and server OS.
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
erwan35
Messages: 8
Registration: Apr 05, 2018 - 5:59 p.m.

April 23, 2018 - 1:14 PM

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)'?
User avatar
htouvet
WAPT Expert
Messages: 436
Registration: March 16, 2015 - 10:48
Contact :

April 23, 2018 - 11:17 PM

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.
Tranquil IT
Locked