• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1640
  • Last Modified:

AdminTask error

The direct Admintask command works for me

AdminTask.addMemberToGroup('[-memberUniqueName uid=xyz,o=defaultWIMFileBasedRealm -groupUniqueName cn=admins,o=defaultWIMFileBasedRealm]')

but when i try to use it as a Jython list it does not

AdminTask.addMemberToGroup(['-memberUniqueName', 'uid=%s','o=defaultWIMFileBasedRealm','-groupUniqueName','cn=%s','o=defaultWIMFileBasedRealm']) %(info[0],info[5])


com.ibm.ws.scripting.ScriptingException: WASX8009E: Invalid parameter: [Ljava.lang.Object;@53ac53ac


Even when i use it as Jython string it gives error.
AdminTask.addMemberToGroup('[-memberUniqueName uid=%s,o=defaultWIMFileBasedRealm -groupUniqueName cn=%s,o=defaultWIMFileBasedRealm]') %(info[0],info[5])


CWWIM4001E The 'uid=%s,o=defaultWIMFileBasedRealm' entity

This is happening only for this particular command , all other AdminTask commands are working when using it as a Jython list


I am using this as the reference

http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.zseries.doc/info/zseries/ae/rxml_atwimmgt.html

Experts  !  Any help is greatly appreciated,


0
wasadmin11
Asked:
wasadmin11
  • 3
1 Solution
 
HonorGodCommented:
The command fails because the string format operator (i.e., the %) isn't being used correctly.

It needs to be used like this:

formatString % variable(s)

For example:

'uid=%s' % info[0]

or

'uid=%s ... cn=%s' % %( info[ 0 ], info[ 5 ] )

So, change this line:
 
AdminTask.addMemberToGroup('[-memberUniqueName uid=%s,o=defaultWIMFileBasedRealm -groupUniqueName cn=%s,o=defaultWIMFileBasedRealm]') %(info[0],info[5])

To this:


AdminTask.addMemberToGroup( '[-memberUniqueName uid=%s,o=defaultWIMFileBasedRealm -groupUniqueName cn=%s,o=defaultWIMFileBasedRealm]' % ( info[ 0 ], info[ 5 ] ) );

Open in new window

0
 
HonorGodCommented:
Sorry for the typo in the 2nd example... (sigh)

'uid=%s ... cn=%s' % %( info[ 0 ], info[ 5 ] )

Should actually be:

'uid=%s ... cn=%s' % ( info[ 0 ], info[ 5 ] )
0
 
wasadmin11Author Commented:
Thanks for the quick response :-) and excellent solution
0
 
HonorGodCommented:
Super.  I'm happy to have been able to help.

Thanks for the grade & points.

Good luck & have a great day.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now