Oscar H
Oscar H

Reputation: 11

jython wsadmin script change to dmgr jvm

I have a script that sets a Custom JVM Property at each of the node agents, but I also want it to do the same at the dmgr level. I'm having a hard time getting the id for the dmgr jvm. Here's my nodeagent script. I'm really struggling with the list, listServers, getid differences.

Thanks to covener's comment, here's the working script

List deplyment manager server

dmgrServer = AdminTask.listServers('[-serverType DEPLOYMENT_MANAGER]').splitlines()

for jvm in dmgrServer: # get dmgr jvm id jvmid = AdminConfig.list('JavaVirtualMachine', jvm) # create new property AdminConfig.create('Property', jvmid, '[[validationExpression ""] [name "MyProperty"] [description "Do cool stuff"] [value "true"] [required "false"]]')

Get all the node agent servers

nodeagents = AdminTask.listServers('[-serverType NODE_AGENT]').splitlines()

for nodeagent in nodeagents: # get the id of the JVM for this node agent server jvmid = AdminConfig.list('JavaVirtualMachine', nodeagent) # set the custom property AdminConfig.create('Property', jvmid, '[[validationExpression ""] [name "MyProperty"] [description "Do cool stuff"] [value "true"] [required "false"]]')

save the configuration changes

AdminConfig.save()

sync all active nodes

AdminNodeManagement.syncActiveNodes()

Upvotes: 1

Views: 846

Answers (1)

covener
covener

Reputation: 17896

Adding comment as an answer:

DEPLOYMENT_MANAGER is a valid server type, so it can be handled exactly the same as the NODE_AGENT loop:

dmgrServer = AdminTask.listServers('[-serverType DEPLOYMENT_MANAGER]').splitlines()

Upvotes: 2

Related Questions