• No replies
4 Posts

Pinned topic if condition under for loop in jython

‏2013-10-15T04:14:26Z |

Hello everybody,


  My script to check Messaging Listener ports on a particular app server is as follow :


import sys
import java
from import FileInputStream
from org.python.modules import time
from import AdminException
lineSep = java.lang.System.getProperty('line.separator')
global AdminConfig
global AdminApp
global AdminControl
global AdminTask
lPorts = AdminControl.queryNames('type=ListenerPort,cell=Cell01,node=node1,process=server1,*')
lPortsArray = lPorts.split(lineSep)
for lPort in lPortsArray:
        lcfgid = AdminControl.getConfigId(lPort)
        lname = AdminConfig.showAttribute(lcfgid, 'name')
        state = AdminControl.getAttribute(lPort, 'started')
if state == 'true':
                   print "Listner Ports are started\n"

                ##Here it takes only last listner port status.
        print "Listner Port" +lname+ "is stopped, starting it\n"
        AdminControl.invoke(lPort, 'start')


The issue is ; it takes only last listener port status from this script , not for all, Please assist, where am i doing wrong ..