def do_admin_connect(self, args): if self.requisites & NEED_CREDENTIALS: print "Connecting to: " + args wl.connect(self.username, self.password, args) self.requisites |= NEED_CONNECTED_AS else: print "Set credentials first with 'credentials username password'"
def connect(self, serverURL,userConfigFile,userKeyFile): self._wl=wl self._serverURL=serverURL self._userConfigFile=userConfigFile self._userKeyFile=userKeyFile if not (self._canConnect()): print consoleUtils.paintAsFail('Wrong connection parameters!') raise WrongParameterException print consoleUtils.paintAsHeader('Trying to connect to '+serverURL+' with user config file ' + userConfigFile) if not self._areUserFilesValid(): print consoleUtils.paintAsFail('Check your user config files, there is something wrong with them...') raise WrongParameterException try: wl.connect(userConfigFile=self._userConfigFile, userKeyFile=self._userKeyFile, url=self._serverURL, timeout=60000) except WLSTException, e: wl.dumpStack() raise FailedConnectionException
import wl print "Connecting to the server ..." wl.connect('weblogic','welcome1','t3://localhost:7021') wl.serverConfig() #wl.serverRuntime() #wl.edit() #wl.startEdit() #wl.cd('/') currentDomainName=wl.cmo.getName() print "currentDomainName = " + currentDomainName currentDir = wl.pwd() print "we are in directory = " + currentDir # wl.cd("/servicebus/serverConfig/SecurityConfiguration/servicebus/DefaultRealm/myrealm/Authorizers/XACMLAuthorizer") wl.cd("SecurityConfiguration/servicebus/DefaultRealm/myrealm/Authorizers/XACMLAuthorizer") #wl.serverRuntime() wl.cmo.exportData('XACML','exportPolicies.xml',wl.Properties()) #wl.cd('serverConfig:/SecurityConfiguration/' + currentDomainName + '/Realms/myrealm/CredentialMappers/DefaultCredentialMapper') #prop=wl.Properties() # wl.cmo.exportData('DefaultCreds','credentialmapper_properties.txt',prop) #wl.cmo.exportData('XACML','exportPolicies.xml',Properties()) # wl.save() #wl.activate(block="true") #wl.disconnect() print "script returns SUCCESS"
def main(): print ' Copyright 2012 Oracle Corporation. ' print ' All Rights Reserved. ' print '' print ' Provided on an ''as is'' basis, without warranties or conditions of any kind, ' print ' either express or implied, including, without limitation, any warranties or ' print ' conditions of title, non-infringement, merchantability, or fitness for a ' print ' particular purpose. You are solely responsible for determining the ' print ' appropriateness of using and assume any risks. You may not redistribute.' print '' print ' Please refer to http://redstack.wordpress.com/continous-integration for details.' print '' print ' This WLST script can be used as part of a continuous integration build process' print ' before deploying a SCA composite, to create any necessary JMS queues' print ' on the WebLogic Server.' print '' print ' In addition to creating the queue, this script will also update the ' print ' resource adapter and redeploy it.' print '' print ' !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!' print '' print ' This script will make changes to your WebLogic domain. Make sure you know ' print ' what you are doing. There is no support for this script. If something bad ' print ' happens, you are on your own! You have been warned.' # # generate a unique string to use in the names # uniqueString = str(int(time.time())) # # Create a JDBC Data Source. # try: print('--> about to connect to weblogic') wl.connect(username, password, url) print('--> about to create a queue ' + qName) wl.edit() wl.startEdit() wl.cd('/JMSSystemResources/' + jmsModule + '/JMSResource/' + jmsModule) wl.cmo.createQueue(qName) wl.cd('/JMSSystemResources/' + jmsModule + '/JMSResource/' + jmsModule + '/Queues/' + qName) wl.set('JNDIName', jndiName) wl.set('SubDeploymentName', jmsSubDeployment) wl.save() print('--> activating changes') wl.activate() print('--> done') # # update the deployment plan # print('--> about to update the deployment plan for the DbAdapter') wl.startEdit() planPath = wl.get('/AppDeployments/JmsAdapter/PlanPath') appPath = wl.get('/AppDeployments/JmsAdapter/SourcePath') print('--> Using plan ' + planPath) plan = wl.loadApplication(appPath, planPath) print('--> adding variables to plan') makeDeploymentPlanVariable(plan, 'ConnectionInstance_eis/wls/' + qName + '_JNDIName_' + uniqueString, eisName, '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="oracle.tip.adapter.jms.IJmsConnectionFactory"]/connection-instance/[jndi-name="' + eisName + '"]/jndi-name') makeDeploymentPlanVariable(plan, 'ConfigProperty_ConnectionFactoryLocation' + uniqueString, eisName, '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="oracle.tip.adapter.jms.IJmsConnectionFactory"]/connection-instance/[jndi-name="' + eisName + '"]/connection-properties/properties/property/[name="ConnectionFactoryLocation"]/value') print('--> saving plan') makeDeploymentPlanVariableplan.save(); makeDeploymentPlanVariablesave(); print('--> activating changes') activate(block='true'); wl.cd('/AppDeployments/JmsAdapter/Targets'); print('--> redeploying the JmsAdapter') print(appName, planPath) wl.redeploy(appName, planPath, targets=cmo.getTargets()) print('--> done') except Exception, inst : print('--> something went wrong, bailing out') print type(inst) # the exception instance print inst.args # arguments stored in .args print inst # __str__ allows args to be printed directly # x, y = inst.args # print 'x =', x # print 'y =', y stopEdit('y') raise SystemExit
# connfact1.setNotes("Use the JNDI name to connect to the JMS queue") print "Creating Queues..." queueList = queues.split(",") for q in queueList: createQueue(theJMSResource, q, jms_module_path) print "Creating Topics..." topicList = topics.split(",") for t in topicList: createTopic(theJMSResource, t, jms_module_path) print "Python version = " + sys.version print "Connecting to the server ..." wl.connect("weblogic", "welcome1", "t3://localhost:7021") wl.edit() wl.startEdit() # set('CompatibilityMBeanServerEnabled', 'true') print "Show command line arguments" print "Argument List:", str(sys.argv) checkParams() servermb = wl.getMBean("Servers/" + adminServer) if servermb is None: print "servermb Value is Null" else: createJMS() try:
def __init__(self, user, password, url): print "Initializing" wl.connect(user, password, url) self.domainMBean = wl.cmo
def __init__(self, user, password, url): print "Initializing" wl.connect(user,password,url) self.domainMBean=wl.cmo
envltr = 't' elif env == "prod": envltr = 'p' else: print("Unsupported environment, please check app_endpoint.yml and retry") adminServerURL = "t3://" + stackPrefix + envltr + stackSuffix + str( stackNum) + "." + stackDomain + ":" + str(non_SSL_port) ssladminServerURL = "t3s://" + stackPrefix + envltr + stackSuffix + str( stackNum) + "." + stackDomain + ":" + str(SSL_port) print(adminServerURL) print(ssladminServerURL) wl.connect(userConfigFile=wlConfigFile, userKeyFile=wlKeyFile, url=ssladminServerURL) wl.redirect('temp.txt', 'False') wl.listApplications() wl.stopRedirect() my_file = open('temp.txt', 'r') appList = my_file.readlines()[:-1] my_file.close appList = [x[:-1] for x in appList] appList = [x[1:] for x in appList] os.remove("temp.txt") if artifactName in appList: print("Deployment found") #initiate stop app