This is more of a lesson share than a question, but I thought someone might find this helpful. I am trying to manage projects for a number of Gateways from a single “parent” Gateway. I would like all of these projects disabled at the parent so they aren’t running erroneous scripts, but I need them re-enabled when I push them to the daughter Gateways. Unfortunately, EAM respects the project enabled attribute, so I have resorted to doing this with scripting through a message handler (this would be a nice addition when pushing projects using EAM).
from com.inductiveautomation.ignition.gateway import IgnitionGateway context = IgnitionGateway.get() projectManager = context.getProjectManager() project = projectManager.getProject(projectName).get() # Need to get() from the java "Optional" object resources = list(project.getAllResources().values()) manifest = project.getManifest() # Need to make sure project is enabled jsonManifest = system.util.jsonDecode(manifest.toJson(manifest)) jsonManifest['enabled'] = True manifest = manifest.fromJson(system.util.jsonEncode(jsonManifest))
Now you would just need to package these up into an object and send it to the remoteGateway where you could use something like
ProjectManager.createOrReplaceProject(projectName, manifest, resources).
The same thing could be accomplished using the file system and editing the
project.json file, but this seemed a bit more straightforward.