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
2 comments:
Of course, it means that while the syntax checking and such may catch most errors, you never know when the same problem might cause an invisible error - one that raises no errors, but gives invalid results or causes damage while running.
After 30+ years of programming, I love the bugs that actually show up when compiling or running. Give me a crash any day over an invisible error.
Ben
Yep, that's SO true.
And, after all this time, I really should know better, and validate my inputs :-)
And yet ...... sigh
Cheers, Dave
Post a Comment