[SOLVED] Audit status Warning and unknown

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
AveyronJJ
Messages: 7
Registration: June 20, 2023 - 1:09 PM

July 24, 2023 - 3:24 PM

Version: WAPTconsole 2.4.0.14031 -1420892a

Hello,

I'm taking over a WAPT installation and some packages and installations that were done by someone who is no longer with our department.
The last thing they did was install a package that copies an ISO image if one isn't already present.
The package does the copy correctly when necessary, but the audit status remains "Warning" on all machines in the inventory section
and "Unknown" in the General tab.
How can I reset these machines to "OK"?

Have a good day!
Last edited by AveyronJJ on July 26, 2023 - 10:34, edited 1 time.
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

July 24, 2023 - 4:27 PM

Hi Jean-Jacques,

could you please provide the contents of your setup.py file so we can see the problem? The return code is returned by the script, so if it's incorrect, we'd need to check the code in the `def install()` function.

The audit status is also handled in the setup.py file, but within the `def audit()` function.

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
AveyronJJ
Messages: 7
Registration: June 20, 2023 - 1:09 PM

July 25, 2023 - 08:14

Hello Denis,

The code is as follows:

Code: Select all

from setuphelpers import *
import shutil
import os
from datetime import datetime

def install():
    # Chemin d'accès au fichier ISO dans le paquet WAPT
    iso_file_path = os.path.join(os.path.dirname(__file__), 'C6440102C-A.iso')

    # Chemin de destination pour la copie de l'ISO
    destination_folder = r'C:\PMF\install\cache\office2016'
    destination_file_path = os.path.join(destination_folder, 'C6440102C-A.iso')

    # Vérification et création du dossier de destination s'il n'existe pas
    if not os.path.exists(destination_folder):
        os.makedirs(destination_folder)
        print(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Le dossier de destination a été créé avec succès.")
    else:
        print(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Le dossier existe déjà.")

    # Vérification si le fichier ISO existe déjà dans la destination
    if not os.path.exists(destination_file_path):
        # Copie de l'ISO vers la destination
        shutil.copy2(iso_file_path, destination_file_path)
        print(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - La copie de l'ISO s'est bien exécutée.")
    else:
        print(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Le fichier ISO est déjà en place.")

    # Chemin du fichier de log
    log_file_path = r'C:\PMF\RAPPINST\CopieOffice2016.log'

    # Ouverture du fichier de log en mode append (ajout à la fin)
    with open(log_file_path, 'a') as log_file:
        log_file.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Copie de Office 2016 : Succès\n")

    print(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Le fichier de log a été mis à jour avec succès.")

    print(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Fin du log.")

def uninstall():
    # Votre code de désinstallation ici
    pass

def session_setup():
    # Votre code de configuration de session ici
    pass

def audit():
    # Votre code d'audit ici
    pass

def update_package():
    # Votre code de mise à jour du package ici
    pass
Sincerely,

Jean-Jacques
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

July 25, 2023 - 5:47 PM

Hello Jean-Jacques,

the `def audit()` function is not defined in the package.

By default, WAPT checks for the presence of the software uninstallation key when creating a software deployment package. Since your package doesn't contain any software installation, the `audit()` function is not defined, hence the "UNKNOWN" status. In the main grid, the UNKNOWN audit status is marked as WARNING to draw attention, but we didn't use UNKNOWN because this status is specific to a package (while the others are probably OK).

In the `audit` function, you can add a simple `return "OK"`, or even better, check that the ISO file is present, and if so, return OK; otherwise, return ERROR.

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
AveyronJJ
Messages: 7
Registration: June 20, 2023 - 1:09 PM

July 26, 2023 - 10:29

Thank you Denis,

have a good day.

Jean-Jacques
Locked