Ejemplo n.º 1
0
def processCMDBManifest(pf):
	""" create the autodeploy file system from a released repository
	supposes a structure as in svn BuildDeliverables
	"""
	repoPath = pf.get("manifest.repository.root")
	manifest = CMDBManifest(pf.get("manifest.file"))
	releaseId = manifest.getReleaseId()
	pscs = manifest.getPSCs()
	deployables = []
	# cater for different transport protocols - right now only file
	antFile = AntCopyProject("antBuildtmpFS.xml", pf.get("manifest.repository.protocol"))
	antFile.setName("createtmpfs")
	antFile.deleteDir("tmp/" + releaseId)
	# cater for getting metadata in different ways - right now only config registry
	metadata = DeploymentMetadata(pf.get("manifest.metadata.source"), pf.get("manifest.metadata.file"))
	for psc in pscs:
		deployable = metadata.getMetadataForPSC(psc)
		if deployable:
			deployables.append(deployable)
			source = repoPath + "/" + deployable["repo-path"]
			pattern = "**/**"
			target = "tmp/" + releaseId + "/" + deployable["name"] + "_" + deployable["version"]
			antFile.copyDir(source, pattern, target)
			# generic name for config folder DC-SR-ORAPP-XX_ROOT hard-coded
			antFile.copyDir(target + "/config", "**", "tmp/" + releaseId + "/DC-SR-ORAPP-XX_ROOT/PSCConfig")
	createAutodeployProperties(antFile, releaseId, deployables)
Ejemplo n.º 2
0
	def testWriteBuildfile(self):
		print "TestAntCopyProject : writeBuildfile"
		project = AntCopyProject("sample_properties/testAntCopyProject.xml", "file")
		project.setName("written-project")
		self.assertEqual(len(self.deployables), 2)
		processed = 0
		project.deleteDir("tmp/package-home")
		for deployable in self.deployables:
			processed += 1
			project.copyDir("d:/repo/" + deployable["repo-path"], "/**/*.*",
							"temp/deployment-root/" + deployable["name"] + "_" + deployable["version"])
		self.assertEqual(processed, 2)
		project.property(name="package.home", value="tmp/package-home")
		project.updateConfigProps("config.properties", "package.home", "tmp/package-home")
		project.createSetEnvFile("PACKAGE_HOME", "/tmp/package-home")
		project.writeBuildfile()
Ejemplo n.º 3
0
	def testDisplayProject(self):
		""" kinda difficult to do strict unit testing here - just displat the results for now
		"""
		print "TestAntCopyProject : displayProject"
		project = AntCopyProject("sample_properties/testCopyProject.xml", "file")
		project.setName("display-project")
		self.assertEqual(len(self.deployables), 2)
		processed = 0
		for deployable in self.deployables:
			processed += 1
			project.copyDir("d:/repo/" + deployable["repo-path"], "/**/*.*",
							"temp/deployment-root/" + deployable["name"] + "_" + deployable["version"])
		self.assertEqual(processed, 2)
		project.copyDir(".", "psc_details.properties", "tmp/package.home")
		project.property(name="package.home", value="tmp/package-home")
		print "--- project xml ---"
		for line in project.project:
			print line