For years if I did something like...
for server in AdminConfig.list('Server').splitlines():
print AdminConfig.showAttribute(server, "services")
print
.. which would return result like this ...
[services [(cells/gcbpmu03cell001/nodes/gcbpmu03cellmgr001/servers/dmgr|server.xml#PMIService_1) (cells/gcbpmu03cell001/nodes/gcbpmu03cellmgr001/servers/dmgr|server.xml#AdminService_1) (cells/gcbpmu03cell001/nodes/gcbpmu03cellmgr001/servers/dmgr|server.xml#TraceService_1) (cells/gcbpmu03cell001/nodes/gcbpmu03cellmgr001/servers/dmgr|server.xml#DiagnosticProviderService_1) (cells/gcbpmu03cell001/nodes/gcbpmu03cellmgr001/servers/dmgr|server.xml#RASLoggingService_1) (cells/gcbpmu03cell001/nodes/gcbpmu03cellmgr001/servers/dmgr|server.xml#CoreGroupBridgeService_1) (cells/gcbpmu03cell001/nodes/gcbpmu03cellmgr001/servers/dmgr|server.xml#ObjectRequestBroker_1) (cells/gcbpmu03cell001/nodes/gcbpmu03cellmgr001/servers/dmgr|server.xml#TransportChannelService_1) (cells/gcbpmu03cell001/nodes/gcbpmu03cellmgr001/servers/dmgr|server.xml#ThreadPoolManager_1) (cells/gcbpmu03cell001/nodes/gcbpmu03cellmgr001/servers/dmgr|server.xml#HTTPAccessLoggingService_1)]]
[stateManagement (cells/gcbpmu03cell001/nodes/gcbpmu03cellmgr001/servers/dmgr|server.xml#StateManageable_1)]
[statisticsProvider (cells/gcbpmu03cell001/nodes/gcbpmu03cellmgr001/servers/dmgr|server.xml#StatisticsProvider_1)]
..I would have had to do some horrible parsing to split out all the services, maybe something like this ...
expString = property.split()[5].split('.]')[0]
.. and as I was coding this I would be cursing IBM for such a crap implementation of python etc etc ...BUT THEN I REALISED IT WAS ME WHO WAS AT FAULT.. there was a much better way to get this information.
Looking at the list of services above, you'll see there are things like PMIService and AdminService and TransportChannelService. (highlighted in blue above)
Well, these can be used as follows
AdminConfig.list('PMIService', server)
Which gives you something like this
(cells/gcbpmu03cell001/nodes/gcbpmu01psadv001node001/servers/PSSIT001.AppTarget.gcbpmu01psadv001node001.0|server.xml#PMIService_1332968737720)
(cells/gcbpmu03cell001/nodes/gcbpmu03psadv001node001/servers/PSSIT001.AppTarget.gcbpmu03psadv001node001.0|server.xml#PMIService_1332968730407)
(cells/gcbpmu03cell001/nodes/gcbpmu01psadv001node001/servers/PSSIT001.Messaging.gcbpmu01psadv001node001.0|server.xml#PMIService_1332968750266)
(cells/gcbpmu03cell001/nodes/gcbpmu03psadv001node001/servers/PSSIT001.Messaging.gcbpmu03psadv001node001.0|server.xml#PMIService_1332968746809)
(cells/gcbpmu03cell001/nodes/gcbpmu01psadv001node001/servers/PSSIT001.Support.gcbpmu01psadv001node001.0|server.xml#PMIService_1332968744147)
(cells/gcbpmu03cell001/nodes/gcbpmu03psadv001node001/servers/PSSIT001.Support.gcbpmu03psadv001node001.0|server.xml#PMIService_1332968740583)
.. i.e. a nice pre-parsed entry for each server
From here you can continue onwards with a feeling that you're using a proper user friendly language :)
I had to celebrate with a cup of tea when I discovered this .. save me hours !
No comments:
Post a Comment