Remote Package Cleanup Editing

Share your tips or issues concerning the WAPT Console or WAPT Agent here
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
Answer
FlavienL
Messages: 11
Registration: May 9, 2023 - 10:36

March 27, 2024 - 09:34

Good morning,

We would like to create a package that would clean/purge the dependencies of the remote package on each machine
Both packages at the depot and older ones:
Capture.PNG
Capture.PNG (23.23 KB) Viewed 9810 times
If that's not possible, we've found that the checkbox:
Capture1.PNG
Capture1.PNG (26.75 KB) Viewed 9810 times
It did not work for multi-selection.

Indeed, when we remove packages from our repositories, if some machines have kept dependencies in their remote package, the latter returns an error because it can no longer find the dependency.

Do you see any mass action that could be taken?

Sincerely,
Flavien
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

March 28, 2024 - 7:15 PM

Hello Flavien,

If you don't already have a "cleanup" package, you can create one and add

Code: Select all

def install():
    WAPT.uninstall('my_package_name')
A cleanup package is also useful for cleaning machines of other software that has been installed "outside of wapt" and that has no reason to exist.

Another way is to select all the machines; the list of all the packages will then appear on the right, and you can run an "uninstall" or "forget" command on the package name in question by right-clicking on it. Be careful to ensure that only the package you want is selected!

Sincerely,

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
FlavienL
Messages: 11
Registration: May 9, 2023 - 10:36

April 3, 2024 - 11:23

Hello Denis,

I misspoke, I do not want to uninstall packages, just purge all the dependencies that are in the machine package (remote package).
We already manage the effective cleanup of packages and software installed on the machines.

Let me explain more precisely; since we have many packages stored on our main server and, even more so, on our local repositories,
Each year we proceed to remove packages that have become unnecessary.
We use OU packets for global broadcasts of our base and then certain packets in a more unitary way (farm of 10 to 100 stations) on certain stations.
When we clean up the repositories, the machine packages go into error because they can no longer find the deleted packages.
The trick would have been to distribute a package that purges all packages made dependent on the machine (present in the Remote Package Editor) before sending the cleanup.

I hope I've been clearer.

Sincerely,
Flavien

PS script for cleaning up packages present on the machines + Storing the history in a log:

Code: Select all

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

chemin_log = "C:\PMF\RAPPINST\PAQUET_NETTOYAGE.log"

def install():

    w = common.Wapt()

    # On récupère ce qu'il y a dans le log

    lines = []

    if isfile(chemin_log):

        f = open(chemin_log, 'r')

        lines = f.readlines()

        f.close()

    # On écrit dans le log

    f = open(chemin_log, 'w')

    # trouve == True <=> au moins un paquet à supprimer a été trouvé

    trouve = False

    print("PAQUETS OBSOLETES EN COURS D'OUBLI : ")

    # On affiche la date du jour

    f.write("*--- " + format(datetime.datetime.now(), '%D %T') + " ---*\n\n")

    # Pour chaque paquet installé sur la machine

    for paquet in w.installed():

        # Si le paquet n'est pas disponible sur le dépot

        if paquet.package != w.host_uuid and not w.is_available(paquet.package):

            trouve = True

            print(paquet.package + " | " + paquet.version)

            # On l'ajoute à la liste des paquets à supprimer (sauf pour le paquet machine, voir condition ci-dessus)

            f.write("  " + paquet.package + " ;; " + paquet.version + '\n')

            # On l'oublie

            w.forget_packages(paquet.package)

    if not trouve:

        print("PMF à jour.")

        f.write("  > PMF à jour.\n")

    # Pour séparer les sections dans le journal :

    f.write("\n")

    # On écrit le reste du log à la suite -> le nettoyage le plus récent apparaît en haut.

    for ligne in lines:

        f.write(ligne)

    f.close()

def audit():

    return "OK"
FlavienL
Messages: 11
Registration: May 9, 2023 - 10:36

April 29, 2024 - 2:07 PM

Hello everyone,

A little update on the topic.

Our idea is to be able to remove the "depends" from the machine package control file:
Capture.PNG
Capture.PNG (39.37 KB) Viewed 8767 times
Thank you for your advice.

Sincerely,
FL
User avatar
jpele
Messages: 156
Registration: March 4, 2019 - 12:01
Location: Nantes

April 30, 2024 - 9:50 AM

Hello,
Could you please contact our phone support so we can best assist you? I'd prefer to fully understand your needs before writing anything incorrect.

Sincerely,
Jimmy
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

May 3, 2024 - 3:58 PM

Hi Flavien,

if the problem only affects a few packages, you can select multiple/all machines and right-click / "Edit multiple machines". Then check "Remove dependencies", select the dependencies you want to remove, and click OK.

Regards,

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
Answer