def testGetConfig(self): print "TestApplicationDeploymentConfig : testGetConfig" pf = XmlProperties("tmp/ant-properties.xml").getAntProperties() for k, psc in pf.getPartialKey("*.pscname"): if pf.get(psc + ".technology") == "webapp": appConfig = ApplicationDeploymentConfig(psc, pf).getConfig() self.assertEqual(appConfig["domain"], "GWA_Applications") self.assertEqual(appConfig["deployable"], os.path.join(pf.get("package.home"), pf.get(psc + ".deployable"))) self.assertEqual(appConfig["admin.user"], "GWAApplicationsAdmin") self.assertEqual(appConfig["target"], pf.get(pf.get(psc + ".target") + ".target.name")) self.assertEqual(appConfig["name"], psc) if pf.get(psc + ".securitymodel"): self.assertEqual(appConfig["security.model"], pf.get(psc + ".securitymodel")) else: self.assertEqual(appConfig["security.model"], "CustomRoles")
return true else : print "Unable to create " + modname + "; cancelling configuration of " + modname + " and aborting" return false elif (action == "drop") : destroyJmsResources(jmsConfig) return true else : print "Unrecognised action: '" + action + "'" return false try: # return a PropertiesFile object containing the ant namespace properties pf = XmlProperties("tmp/ant-properties.xml").getAntProperties() debug = pf.get("weblogic.script.debugging") if debug == "on": debugging = true else: debugging = false action = pf.get("managejmsresources.action") modules = pf.getPartialKey("*.jms.system.module.name") if debugging: print "[DEBUG] len(modules): %i" % len(modules) print "[DEBUG] modules[0][1]: " + modules[0][1] print "[DEBUG] action: " + action for k, modname in modules: print "Processing properties for JMS resource ID: %s" % (modname) jmsConfig = JMSResourceConfig(modname, pf).getConfig() datasourcename = jmsConfig["datasource"]
deployable["artefact"] = latest artefact = deployable["artefact"] sourceDir = repoHome + "/" + deployable["repo-path"] target = deployPackageHome + "/" + deployable["name"] antFile.copyFile(sourceDir, artefact, target) createAutodeployProperties(antFile, releaseId, deployables) def createAutodeployProperties(antFile, packageHome, deployables): """ do the bits that are common to all ant files like create the properties file and set package.home """ # force protocol to file for local file copy antFile.copyDir(".", "psc_details.properties", "tmp/" + packageHome, protocol="file") antFile.property(name="package.home", value="tmp/" + packageHome) antFile.updateConfigProps("environment-config.properties", "package.home", "tmp/" + packageHome) antFile.createSetEnvFile("PACKAGE_HOME", "tmp/" + packageHome) antFile.writeBuildfile() detailsFile = PSCDetailsFile(deployables).writeFile(".") pf = XmlProperties("tmp/ant-properties.xml").getAntProperties() manifestSource = pf.get("manifest.source") # cater for different kinds of manifest - right now only cmdb and ci if manifestSource == "cmdb": processCMDBManifest(pf) elif manifestSource == "ci": processCIManifest(pf) else: raise
except: return false return true def isDeployed(appConfig): """ check if application is deployed """ deployed = false if len( re.findall(appConfig["name"], ls('/AppDeployments')) ) > 0: deployed = true return deployed try: # return a PropertiesFile object containing the ant namespace properties pf = XmlProperties("tmp/ant-properties.xml").getAntProperties() debug = pf.get("weblogic.script.debugging") if debug == "on": debugging = true else: debugging = false action = pf.get("deployApplications.action") if not (action == "deploy" or action == "undeploy"): print "Action must be 'deploy' or 'undeploy'" exit(exitcode=2) # Holder for name of domain to which we're currently connected: # use it to avoid re-connecting to domain already connected currentDomain = None pscs = pf.getPartialKey("*.pscname") applications = []