-
Notifications
You must be signed in to change notification settings - Fork 1
/
Purge.py.erb
32 lines (27 loc) · 1.41 KB
/
Purge.py.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from javax.management.openmbean import CompositeDataSupport
connect('<%= @wlsuser %>','<%= @wlspassword %>','<%= @soaserverurl %>')
custom()
PurgeConfigobj = ObjectName('oracle.soa.config:name=purge,type=AutoPurgeJobConfig,Application=soa-infra')
purgeJobDet = mbs.getAttribute(PurgeConfigobj,'PurgeJobDetails')
print '# of purge entries: ' + str(len(purgeJobDet))
cntPurge=0;
for retentionRule in purgeJobDet:
print retentionRule.get('jobName') + ', retention period: ' + str(retentionRule.get('retentionPeriod'))
if retentionRule.get('jobName') == '<%= @jobName %>':
# 'delete_instances_auto_job1':
print 'Entry ' + retentionRule.get('jobName') + ' has to be changed'
keys = retentionRule.getCompositeType().keySet().toArray()
keyitems = [ key for key in keys ]
values = retentionRule.getAll(keyitems)
cnt=0;
for key in keys:
if key == 'retentionPeriod':
values[cnt] = <%= @retentionPeriod %>
print '*** bpel: set ' + key + ' to value ' + str(values[cnt])
updatedRetentionRule = CompositeDataSupport(retentionRule.getCompositeType(), keyitems, values)
purgeJobDet[cntPurge] = updatedRetentionRule
SOAattribute = Attribute('PurgeJobDetails', purgeJobDet)
mbs.setAttribute(PurgeConfigobj, SOAattribute)
break
cnt = cnt + 1;
cntPurge = cntPurge + 1