I'm developing lots of scripts for managing WAS infrastructure and I'm getting an impression that somebody at IBM has screwed up wsadmin
on purpose. It couldn't be an accident.
Here's a "simple" example:
for node in AdminConfig.list('Node').splitlines():
nodeName = AdminConfig.showAttribute(node, 'name')
for srv in AdminConfig.list('Server', node).splitlines():
if AdminConfig.showAttribute(srv, 'serverType') == 'APPLICATION_SERVER':
serverName = AdminConfig.showAttribute(srv, 'name')
prop = AdminConfig.getid('/Node:%s/Server:%s/JavaProcessDef:/JavaVirtualMachine:/Property:java.awt.headless/' % (nodeName, serverName))
if prop:
AdminConfig.modify(prop, [ ['value','true'] ])
else:
jvm = AdminConfig.getid('/Node:%s/Server:%s/JavaProcessDef:/JavaVirtualMachine:/' % (nodeName, serverName))
AdminConfig.create('Property', jvm, [ ['name', 'java.awt.headless'], ['value', 'true'] ], 'systemProperties')
The above script is not only not maintainable, it's just unreadable. The wsadmin
tool is a write-only tool! One writes a script and on next day can't understand how it works or even what it does!
Wouldn't it be easier like this?:
for node in list('Node'):
nodeName = node.name
for srv in node.list('Server'):
if srv.serverType == 'APPLICATION_SERVER':
jvm = srv.processDefinitions[0].jvmEntries[0]
jvm.createOrModify('Property', { 'name': 'java.awt.headless' }, { 'value': 'true' })
... one could easily figure out what the script does without spending minutes on trying to understand that hectic API if only WAS scripting was friendlier. Not to mention the ease of maintenance.
Has anybody ever seen/attempted to implement a friendlier administration tool (or wsadmin library)?
I'm asking because I'm actually planning to do develop a friendly Jython library, I'd just like to avoid reinventing the wheel.
I've seen plenty of task-oriented Jython libraries. Some of them are available in newer versions of WAS, others have been published on IBM developerWorks, some libraries are available on the web. To me, they're yet another API to learn and they're only useful for limited set of tasks. I'm rather looking for general-purpose WAS scripting tool/library.
Edit: This question was part of a research preceding a larger WebSphere automation project. Library I was asking about did not exist at that time, therefore I've started developing WDR. You may find it here: http://wdr.github.io/WDR/.