First of all let me thank everyone here for having a great forum. I've been visiting this forum for the longest time but just recently came upon something that I need to start a new topic for.
I am trying to write a JYTHON script to retrieve datasource properties for all the datasources configured in our UNIT environment so they can be compared to datsources defined in other environments. I believe somewhere in the script I am messing the syntax which makes the script fail.
For ease of understanding (or not) I am posting everything that I tried (most of it is commented out).
All the print statements are working but I can get the AdminTask statement to create the file with all the properties.
For some reason I whatever I try I am not able to send the datasource names as a variable to the "-configData DataSource=" statement. Works fine when I assign and actaul datasource name instead of sending it as a string variable.
I've tried many things and finally decided to seek help from the experts. Thanks for any help I can get!
####Beginning of the script####
# get cell id, just for printing reasons
cell = AdminConfig.list('Cell')
# from cell id, get cell name, again just for printing
cell_name = AdminConfig.showAttribute(cell, 'name')
dsources = AdminConfig.list('DataSource')
dsources1 = dsources.split(lineSeparator)
#for every data source get name
for dsource in dsources1:
dsource_name = AdminConfig.showAttribute(dsource, 'name')
# datasrce = dsource_name
# AdminTask.extractConfigProperties('-configData DataSource=itsmdb', '-propertiesFileName /home/92188/newfile.properties')
# print pool
x = "DataSource=%s" %datsrce
y = "-configData %s" %x
z = "/home/40709/sampleds3.properties"
i = "-propertiesFileName %s" %z
#hello = "'%s %s'" % (y , i)
hello = '%s %s' % (y , i)
#print "AdminTask.extractConfigProperties(%s)" % hello
AdminTask.extractConfigProperties(%s) % hello
#AdminTask.extractConfigProperties('%s' ,'%s') % (y , i)
#AdminTask.extractConfigProperties(-configData 'DataSource=%s' %(datsrce) -propertiesFileName /home/40709/sampleds3.properties)
# for x in dsources1:
# AdminTask.extractConfigProperties('-configData DataSource=dsource_name -propertiesFileName /home/92188/dsource_name1.properties')
####Uncomment the lines below for datasources on each node and place them higher up in the script####
# get list of node id's
#nodes = AdminConfig.list('Node')
# format node id's for jython
#nodes1 = nodes.split(lineSeparator)
# for each node, get list of servers etc and format for jython
#for node in nodes1:
# node_name = AdminConfig.showAttribute(node, 'name')
# dsources = AdminConfig.list('DataSource', node)