Topic
  • 2 replies
  • Latest Post - ‏2008-06-09T11:13:02Z by RuneH
RuneH
RuneH
41 Posts

Pinned topic How to create a TAI Interceptor with properties using Jython

‏2008-06-06T14:53:38Z |
I want to define a TAI Interceptor with properties using Jython, but I have not managed to figure out how to get the bits and pieces together yet.

I've managed to list out the content, but...this script only list the first occurence, then it always fails (as it seems to me) with the error "Cannot create object name", so if someone btw could give me a hint about that one it would be nice.




import sys
print " -- Attributes ---"
print AdminConfig.attributes( 'TAInterceptor')
taiInt = AdminConfig.list( "TAInterceptor")
taiSubst = taiInt.split( '\r')
for tai in taiSubst:
try:
print "-------------" print AdminConfig.show(tai, ' trustProperties')
print "-------------" except:
print "Error when getting: " + tai
print "Continue..."


I assume that creating a new TAInterceptor is something like

AdminConfig.create(
"TAInterceptor", taiId, 
"[,")
or
AdminConfig.create( "TAInterceptor", taiId, "[,['cheese'")
which both fails with the error

Attribute=interceptorClassName had invalid value=, 

for input parameter=,

Not quite able to figure out the strucutre of the attribute-parameter
Updated on 2008-06-09T11:13:02Z at 2008-06-09T11:13:02Z by RuneH
  • infyniti
    infyniti
    215 Posts

    Re: How to create a TAI Interceptor with properties using Jython

    ‏2008-06-06T19:19:27Z  
    Here is the jython snippet to create a new TAInterceptor and add trust properties.

    security = AdminConfig.list("Security" )
    trustAssociation = AdminConfig.list("TrustAssociation" )
    TAI_List = AdminConfig.list("TAInterceptor" )

    TAI_attrib = []
    TAI_attrib.append(['interceptorClassName', 'Name'])
    TAInterceptor = AdminConfig.create("TAInterceptor", trustAssociation, TAI_attrib )
    attrs = []
    attrs.append(['name', 'propertyName'])
    attrs.append(['value', 'propertyValue'])
    AdminConfig.create("Property", TAInterceptor, attrs, "trustProperties" )
    Updated on 2008-06-06T19:19:27Z at 2008-06-06T19:19:27Z by infyniti
  • RuneH
    RuneH
    41 Posts

    Re: How to create a TAI Interceptor with properties using Jython

    ‏2008-06-09T11:13:02Z  
    • infyniti
    • ‏2008-06-06T17:02:39Z
    Here is the jython snippet to create a new TAInterceptor and add trust properties.

    security = AdminConfig.list("Security" )
    trustAssociation = AdminConfig.list("TrustAssociation" )
    TAI_List = AdminConfig.list("TAInterceptor" )

    TAI_attrib = []
    TAI_attrib.append(['interceptorClassName', 'Name'])
    TAInterceptor = AdminConfig.create("TAInterceptor", trustAssociation, TAI_attrib )
    attrs = []
    attrs.append(['name', 'propertyName'])
    attrs.append(['value', 'propertyValue'])
    AdminConfig.create("Property", TAInterceptor, attrs, "trustProperties" )
    Super, tnx a lot - that did the trick.

    Also a bit embarrasing, the reason for my "list details"-script failed was very simple, I had just forgot to add .lstrip() to remove '\n' . Then the ID became valid.

    So now I'm able to write a script that generates all the needed TAI's based on a property-file.