This repository has been archived by the owner on Feb 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcluster
52 lines (40 loc) · 1.86 KB
/
cluster
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/opt/puppetlabs/puppet/bin/ruby
require 'base64'
require 'rest-client'
require 'json'
user = 'weblogic'
pwd = 'weblogic1'
domain = 'default'
response = RestClient.get("http://10.10.10.10:7001/management/weblogic/latest/domainConfig/clusters",
{:authorization => "Basic #{Base64.strict_encode64("#{user}:#{pwd}")}",
:accept => 'application/json'})
case response.code
when 200
items = JSON.parse(response)[ 'items' ]
all_cluster = Array.new
items.each do |item|
cluster = Hash.new
cluster['domain'] = 'default'
cluster['name'] = "#{domain}/#{item['name']}"
cluster['clusteraddress'] = item['clusterAddress']
servers_array = Array.new
item['servers'].each do |server|
servers_array.push server['identity'][1]
end
cluster['servers'] = servers_array.join(',')
cluster['messagingmode'] = item['clusterMessagingMode']
cluster['multicastaddress'] = item['multicastAddress']
cluster['unicastbroadcastchannel'] = item['ClusterBroadcastChannel']
cluster['multicastport'] = item['multicastPort']
cluster['frontendhost'] = item['frontendHost']
cluster['frontendhttpport'] = item['frontendHTTPPort'] == 0 ? nil : item['frontendHTTPPort']
cluster['frontendhttpsport'] = item['frontendHTTPSPort'] == 0 ? nil : item['frontendHTTPSPort']
cluster['migrationbasis'] = item['migrationBasis']
cluster['migration_table_name'] = item['autoMigrationTableName']
cluster['migration_datasource'] = item['dataSourceForAutomaticMigration']
cluster['securereplication'] = item['secureReplicationEnabled']
cluster['datasourceforjobscheduler'] = item['dataSourceForJobScheduler']
all_cluster.push cluster
end
puts all_cluster
end