[BUG] Ignition 8.0.16-RC1 - system.util.audit - auditProfile mandatory for runscript in tag expression

Ignition 8.0.16-RC1

I use a gateway expression tag with a runscript expression to log some audit.

If I don’t provide the auditProfile to system.util.audit, I have an error.
The gateway audit profil seem to be ignored in this case.

image

system.util.audit(action = "gateway activity level", actionTarget = ("%s => %s" % (role,activityLevel)))
Fct: 'shared.commun.audit.addAuditGatewayRole' Contexte: Type='<type 'exceptions.ValueError'>' Err='audit(): No audit profile provided or found for the project' Stack=Traceback (most recent call last): File "<module:shared.commun.audit>", line 194, in addAuditGatewayRole ValueError: audit(): No audit profile provided or found for the project

with:

system.util.audit(auditProfile = "audit", action = "gateway activity level", actionTarget = ("%s => %s" % (role,activityLevel)))

All is fine

Given the error you are receiving and the fact that you are calling a project script, it sounds like the project that contains the ‘shared.common.audit.addAuditGatewayRole’ script method is missing a project level audit profile.

From my understanding, the runScript() expression function will run in the scope of the Gateway Scripting Project instead of the gateway scope unless the Gateway Scripting Project is empty despite it being a tag. Your expression in particular has to run in project scope as it is calling a project level script as well.

However, in the case that your Gateway Scripting Project is set to nothing, then you can do an expression such as runScript('system.util.audit(action = "gateway activity level") which will then use the Gateway Audit Profile as it will not have a project to be in scope of. But, the moment the Gateway Scripting Project is filled, then it will run in that project’s scope even if you do not call a project script from that expression.