Discussion:
Is there a way to access the WAS variables in a wsadmin Jython script?
(too old to reply)
waugie
2007-10-24 13:27:23 UTC
Permalink
Is there a way to obtain the WAS environment variables name-value pairs from within a wsadmin Jython script? (e.g. WAS_INSTALL_ROOT)
Infyniti
2007-10-24 14:41:44 UTC
Permalink
Yes, Here is the python script which prints all WebSphere Variables created at the cell level. You change the cell scope to either node, cluster or server level depends on where the variable is created.

Thanks
Anant


*******************************************************************************
import sys
def wsadminToList(inStr):
outList=[]
if (len(inStr)>0 and inStr[0]=='[' and inStr[-1]==']'):
tmpList = inStr[1:-1].split(" ")
else:
tmpList = inStr.split("\n") #splits for Windows or Linux
for item in tmpList:
item = item.rstrip(); #removes any Windows "\r"
if (len(item)>0):
outList.append(item)
return outList
#endDef

cell = AdminConfig.list("Cell")
cellName = AdminConfig.showAttribute(cell, "name")
cellWebSphereVariableMap = AdminConfig.getid("/Cell:"+cellName+"/VariableMap:/")
cellEntries = AdminConfig.showAttribute(cellWebSphereVariableMap, "entries")
entryList = wsadminToList(cellEntries)

if (len(cellEntries) != '[]'):
for cellEntry in entryList:
varName = AdminConfig.showAttribute(cellEntry, "symbolicName")
print "var Name is : "+varName
varVal = AdminConfig.showAttribute(cellEntry, "value")
print " var value is : "+varVal
#endFor
#endIf

*******************************************************************************
s***@gmail.com
2015-10-05 20:18:24 UTC
Permalink
A system administrator has created a Python script called globalScript. py.
What should the administrator do to ensure globalScript. py is loaded when the wsadmin shell is
used?

A.
Compile globalScript.py to a Java class in the bin directory.

B.
Invoke wsadmin with the argument-profileName globalScript.py.

C.
Modify the configureCustomProperty script to import globalScript. py.

D.
D. Set the script profiles in the wsadmin.properties file to load globalScript .py.
z***@gmail.com
2016-05-12 08:34:00 UTC
Permalink
Post by s***@gmail.com
A system administrator has created a Python script called globalScript. py.
What should the administrator do to ensure globalScript. py is loaded when the wsadmin shell is
used?
A.
Compile globalScript.py to a Java class in the bin directory.
B.
Invoke wsadmin with the argument-profileName globalScript.py.
C.
Modify the configureCustomProperty script to import globalScript. py.
D.
D. Set the script profiles in the wsadmin.properties file to load globalScript .py.
D

Loading...