0

Jython スクリプトを使用して WebSphere Console に管理ユーザーを追加する必要があります。「コマンド支援コマンドをログに記録する」設定をオンにしようとしましたが、ユーザーの追加がログに記録されませんでした。ただし、他のものはログに記録しました。

多くのサーバーをセットアップし、セットアッププロセス全体をスクリプト化しようとしています.

乾杯、コンラッド

4

1 に答える 1

4

私はまだ管理ユーザーを作成していませんが、JAAS ユーザーを作成しています。スクリプトに従うと、それを行う方法について十分なヒントが得られる場合があります。

def dbAuthenticationAlias():
   print 'Create JAAS - J2C Authentication Alias'

   #--------------------------------------------------------------
   # Check if JAAS - J2C Authentication Alias exists
   #--------------------------------------------------------------

   global dbuseralias

   # generate user alias
   dbuseralias = nodeName + '/' + dbuser

   # get context 
   sec = AdminConfig.getid('/Cell:%s/Security:/' % cellName)

   #Get all J2C Authentication Aliases (they are separated by \n
   j2c = AdminConfig.list('JAASAuthData',sec)

   found = 0
   if len(j2c) > 0 :
      for j2cUserId in j2c.splitlines():
         if AdminConfig.showAttribute(j2cUserId,"alias") == dbuseralias:
            found = 1

   #--------------------------------------------------------------
   # Create a JAAS - J2C Authentication Alias
   #--------------------------------------------------------------
   if found == 0 :
      print 'user not found, creating'

      # create structure for J2C Authentication Alias
      jaasAttrs = [['alias', dbuseralias],['userId', dbuser],['password',dbpassword]]  

      #create J2C Authentication Alias
      AdminConfig.create('JAASAuthData', sec, jaasAttrs)

      print 'user %s created' % dbuseralias

      #saving
      adminConfigSave()
   else:
      print 'user found'

これまでのところ、特定の設定を行う場所を見つけるという問題がありました。そのため、wsadmin ツール内で次のコマンドを使用して、現在の構成を取得しました。

sec = AdminConfig.getid('/Cell:%s/Security:/' % cellName)
#shows all attributes for the config element given by an ID 
print AdminConfig.show(sec) 
#shows all attributes and expands the attributes where necessary 
print AdminConfig.showall(sec) 

セキュリティ設定を取得する代わりに、サーバー設定を取得して、構成ツリーの奥に移動することもできます。

srv = AdminConfig.getid('/Node:%s/Server:%s/' % (node,server)) 
#get the process definition from server config 
prcDef = AdminConfig.list('ProcessDef',srv) 
#get JVM config from process definition 
jvm= AdminConfig.list('JavaVirtualMachine',prcDef) 
于 2010-02-11T18:50:57.153 に答える