Skip to content

Commit db0777b

Browse files
Port bug fix
1 parent 89f1a6f commit db0777b

File tree

1 file changed

+52
-5
lines changed

1 file changed

+52
-5
lines changed

resource_creation.py

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
'''
2+
#################################################################
3+
4+
# Author : Sagar Pawar
5+
26
This script helps in creating following resources:
37
- Manage Server
48
- File Store
@@ -12,10 +16,17 @@
1216
Steps to un Script:-
1317
1. Paste File on server
1418
2. Go in /scratch/oracle/Oracle/Middleware/Oracle_Home/oracle_common/common/bin
15-
3. Run following command "sh wlst.sh <File Path>" [e.g. sh wlst.sh /scratch/dumps/resource_creation.py]
19+
3. Run following command "sh wlst.sh <File Path>" [e.g. sh wlst.sh /scratch/dumps/create_queue.py]
20+
21+
Pending Improvements:-
22+
Setting SSL ports
23+
Datasource creation
24+
FileStore storage directory creation
25+
#################################################################
1626
'''
27+
1728
#Module
18-
module_name = 'ITR'
29+
module_name = 'Script'
1930

2031
#Server Credentials
2132
weblogic_uname = 'weblogic'
@@ -70,6 +81,36 @@
7081
#--------------------Script Starts <DO NOT TOUCH>-------------------------
7182
import weblogic.descriptor.BeanAlreadyExistsException
7283

84+
'''----------------UTILS----------------'''
85+
class Util:
86+
def getNextAvailablePort(self):
87+
print '==> Entering getNextAvailablePort()'
88+
#Suppress ls() Output
89+
redirect('/dev/null','false')
90+
servers = ls('/Servers',returnMap='true')
91+
print servers
92+
ports = list()
93+
for server in servers:
94+
print '==>Goint to Dir: '+'/Servers/'+server
95+
cd('/Servers/'+server)
96+
port = cmo.getListenPort()
97+
ports.append(port)
98+
ports.sort()
99+
curr_port = ports[0]
100+
for port in ports:
101+
if port > curr_port:
102+
break
103+
else:
104+
curr_port = curr_port+1
105+
#Activate ls Output
106+
stopRedirect()
107+
print '==> Exiting getNextAvailablePort() Return: '+str(curr_port)
108+
return curr_port
109+
110+
def createDirIfNotExists(self, path):
111+
pass
112+
113+
73114
'''Creating Variables'''
74115
manage_server = "MangServer_" + module_name
75116
system_module = "SystemModule_" + module_name
@@ -82,6 +123,7 @@
82123
connect(weblogic_uname, weblogic_pass, weblogic_url)
83124
edit()
84125
startEdit()
126+
util = Util()
85127

86128
'''Creating Manage Server'''
87129
print '------------Creating Manage Server------------'
@@ -97,7 +139,14 @@
97139
cmo.createServer(manage_server)
98140
cd(mang_server_path)
99141
cmo.setListenAddress('')
100-
cmo.setListenPort(7015)
142+
port = util.getNextAvailablePort()
143+
cmo.setListenPort(port)
144+
#Enable SSL port
145+
cmo.setCluster(None)
146+
mang_server_ssl_path = mang_server_path + '/SSL/' + manage_server
147+
cd(mang_server_ssl_path)
148+
cmo.setEnabled(true)
149+
cmo.setListenPort(1000+port)
101150

102151
'''Creating FileStore'''
103152
print '------------Creating File Store------------'
@@ -237,5 +286,3 @@
237286

238287
'''Activate'''
239288
activate()
240-
241-

0 commit comments

Comments
 (0)