Page 1 of 1

Remote Package Cleanup Editing

Published: March 27, 2024 - 09:34
by FlavienL
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 9806 times
If that's not possible, we've found that the checkbox:
Capture1.PNG
Capture1.PNG (26.75 KB) Viewed 9806 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

Re: Remote Package Editing Cleanup

Published: March 28, 2024 - 7:15 PM
by dcardon
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

Re: Remote Package Editing Cleanup

Published: April 3, 2024 - 11:23 AM
by FlavienL
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"

Re: Remote Package Editing Cleanup

Published: April 29, 2024 - 2:07 PM
by FlavienL
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 8763 times
Thank you for your advice.

Sincerely,
FL

Re: Remote Package Editing Cleanup

Published: April 30, 2024 - 9:50 AM
by jpele
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

Re: Remote Package Editing Cleanup

Published: May 3, 2024 - 3:58 PM
by dcardon
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