It's days like this when I hate the way that macOS handles the apostrophe, also known as the single quote character.
Specifically, I mean this character: -
'
or do I mean THIS character: -
'
?
Yes, it's the latter and, for some annoying reason, macOS likes to switch from one to t'other, just to annoy me.
So I'm trying to run a Jython script: -
cellID=AdminControl.getCell()
nodeNames = AdminTask.listNodes().splitlines()
for nodeName in nodeNames:
AdminControl.invoke('WebSphere:name=repository,process=nodeagent,platform=common,node='+nodeName+',version=5.0,type=ConfigRepository,mbeanIdentifier=repository,cell='+cellID+',spec=1.0','refreshRepositoryEpoch')
but I keep getting: -
nodeNames = AdminTask.listNodes().splitlines()
for nodeName in nodeNames:
AdminControl.invoke('WebSphere:name=repository,process=nodeagent,platform=common,node='+nodeName+',version=5.0,type=ConfigRepository,mbeanIdentifier=repository,cell='+cellID+',spec=1.0','refreshRepositoryEpoch')
but I keep getting: -
Traceback (innermost last):
(no code object) at line 0
File "<input>", line 2
AdminControl.invoke('WebSphere:name=repository,process=nodeagent,platform=common,node='+nodeName+',version=5.0,type=ConfigRepository,mbeanIdentifier=repository,cell='+cellID+',spec=1.0','refreshRepositoryEpoch')
^
SyntaxError: invalid syntax
(no code object) at line 0
File "<input>", line 2
AdminControl.invoke('WebSphere:name=repository,process=nodeagent,platform=common,node='+nodeName+',version=5.0,type=ConfigRepository,mbeanIdentifier=repository,cell='+cellID+',spec=1.0','refreshRepositoryEpoch')
^
SyntaxError: invalid syntax
It took me an AGE to see where I was going wrong.
Once I fixed my syntax : -
cellID=AdminControl.getCell()
nodeNames = AdminTask.listNodes().splitlines()
for nodeName in nodeNames:
AdminControl.invoke('WebSphere:name=repository,process=nodeagent,platform=common,node='+nodeName+',version=5.0,type=ConfigRepository,mbeanIdentifier=repository,cell='+cellID+',spec=1.0','refreshRepositoryEpoch')
things moved along.
nodeNames = AdminTask.listNodes().splitlines()
for nodeName in nodeNames:
AdminControl.invoke('WebSphere:name=repository,process=nodeagent,platform=common,node='+nodeName+',version=5.0,type=ConfigRepository,mbeanIdentifier=repository,cell='+cellID+',spec=1.0','refreshRepositoryEpoch')
things moved along.
I then saw this: -
WASX7015E: Exception running command: ""; exception information:
javax.management.InstanceNotFoundException: WebSphere:name=repository,process=nodeagent,platform=common,node=Dmgr,version=5.0,type=ConfigRepository,mbeanIdentifier=repository,cell=PCCell1,spec=1.0
which makes sense, as I'm trying to synchronise a Deployment Manager ( there are two nodes within my cell, and my loop doesn't distinguish between them ).
javax.management.InstanceNotFoundException: WebSphere:name=repository,process=nodeagent,platform=common,node=Dmgr,version=5.0,type=ConfigRepository,mbeanIdentifier=repository,cell=PCCell1,spec=1.0
which makes sense, as I'm trying to synchronise a Deployment Manager ( there are two nodes within my cell, and my loop doesn't distinguish between them ).
I further fixed my script: -
cellID=AdminControl.getCell()
nodeNames = AdminTask.listNodes().splitlines()
for nodeName in nodeNames:
if nodeName.find('D') == -1:
AdminControl.invoke('WebSphere:name=repository,process=nodeagent,platform=common,node='+nodeName+',version=5.0,type=ConfigRepository,mbeanIdentifier=repository,cell='+cellID+',spec=1.0','refreshRepositoryEpoch')
nodeNames = AdminTask.listNodes().splitlines()
for nodeName in nodeNames:
if nodeName.find('D') == -1:
AdminControl.invoke('WebSphere:name=repository,process=nodeagent,platform=common,node='+nodeName+',version=5.0,type=ConfigRepository,mbeanIdentifier=repository,cell='+cellID+',spec=1.0','refreshRepositoryEpoch')
and now have something that works ( it's primitive, in that it ignores nodes that begin with D e.g. Deployment Manager == Dmgr01