Page 1 of 1

[RESOLVED] Package dependent on the result of the previous audit

Published: February 14, 2024 - 11:43 AM
by brice73
Hello,

I'm updating a package and I wanted to condition an action on the status of the last existing audit (i.e., the version of the package installed on the machine). I'm having trouble retrieving this information.

The new version of the package is being tested using PyScripter on a machine where the previous version of the package is installed.

If I use `WAPT.audit(package)` in the new package, it executes the new `audit()` function of that package, which I modified, so it's not suitable.

I found the `packages_audit_inventory()` . The problem is that if I execute this function in the interpreter, I can retrieve the old audit status of the package, but when the `install()` function of the new package is executed, the list corresponding to the package returned by the `packages_audit_inventory()` function is modified beforehand, and its last three elements (including the status value) are set to `None`. Therefore, I can't retrieve the existing audit status of the package with this function either.

Is there a solution to retrieve the package's audit status?

Re: Package dependent on the result of the previous audit

Published: February 15, 2024 - 4:53 PM
by dcardon
Hello Brice,

If it's to retrieve the last `def audit()`, you can try:

Code: Select all

WAPT.waptdb.query("select last_audit_status from wapt_localstatus l where l.package=? and l.install_status='UPGRADING' and l.install_date is not null limit 1",(control.package,))
If the audit is logged, you can try:

Code: Select all

list(w.read_audit_data_set('disable-telemetry', 'audit-status', as_dict=True, raw_data=False, descending=True))
Sincerely,

Denis

Re: Package dependent on the result of the previous audit

Published: February 19, 2024 - 9:30 PM
by brice73
Hello Denis,

Thank you for your replies. I was able to retrieve the package audit status using the first method (WAPT.waptdb.query). :)

Regards,
Brice

Re: Package dependent on the result of the previous audit

Published: February 20, 2024 - 1:40 PM
by dcardon
Hi Brice,

thanks for the feedback, :-)
I'm marking the topic as RESOLVED.

Denis