I have 2 applications deployed in weblogic:
app1: target1, target2
app2: target3
And for assigning target2 to app2 I perform next wlst commands:
connect('user', 'password', 't3://admin-address:admin-port')
undeploy("app1", targets="target2")
disconnect()
readDomain('domain-dir')
assign("AppDeployment","app2","Target","target2")
updateDomain()
closedomain()
There are no errors, but only undeployment of app1 from target2 works. Could someone help here?
The final solution is:
connect('user', 'password', 't3://<admin_server>:<admin_port>')
# remove target from the first application
edit()
startEdit()
cd('/AppDeployments/app1')
set('Targets',jarray.array([ObjectName('com.bea:Name=target1,Type=Server')], ObjectName))
activate()
exit()
# add target to the second application
edit()
startEdit()
cd('/AppDeployments/app2')
set('Targets',jarray.array([ObjectName('com.bea:Name=target2,Type=Server'), ObjectName('com.bea:Name=target3,Type=Server')], ObjectName))
activate()
exit()