class CIManifest(DeploymentManifest): def __init__(self, fileName): self.wb = SpreadSheet(fileName).getSpreadSheet() sheet = self.wb.getSheet("DeploymentId") row = sheet.getRow(0) cell = row.getCell(0) self.releaseId = cell.getStringCellValue() sheet = self.wb.getSheet("Deployables") rows = sheet.getPhysicalNumberOfRows() self.pscList = [] for i in range(rows): if i > 0: row = sheet.getRow(i) if row: name = row.getCell(1).getStringCellValue() version = row.getCell(0).getStringCellValue() self.pscList.append((name, version))
class ConfigRegistry: """ convenience wrapper to enable the interim use of the existing config registry spreadsheet to acquire metadata for deployment """ def __init__(self, wbFile): self.wb = SpreadSheet(wbFile).getSpreadSheet() def getDeployables(self): """ return a list of dicts name : pscname version : version technology : technology packaging : packaging repo-path : path in repo artefact : artefact name target : deploy target security-model : security model """ sheet = self.wb.getSheet("Deployables") rows = sheet.getPhysicalNumberOfRows() deployables = [] for i in range(rows): if not i == 0: row = sheet.getRow(i) deployable = {} if row: pscVersion = row.getCell(1) tech = row.getCell(2) repoPath = row.getCell(5) if pscVersion and tech and repoPath: pscBits = pscVersion.getStringCellValue().split("_") deployable["name"] = pscBits[0] deployable["version"] = "_".join(pscBits[1:]) tech = row.getCell(2) deployable["technology"] = tech.getStringCellValue().strip() package = row.getCell(3) if package: deployable["packaging"] = package.getStringCellValue().strip() artefact = row.getCell(4) if artefact: deployable["artefact"] = artefact.getStringCellValue().strip() repoPath = row.getCell(5) repoPathValue = repoPath.getStringCellValue().strip() if repoPathValue.endswith("/"): deployable["repo-path"] = repoPathValue[:-1] else: deployable["repo-path"] = repoPathValue target = row.getCell(6) if target: deployable["deploy-target"] = target.getStringCellValue().strip() secModel = row.getCell(7) if secModel: deployable["security-model"] = secModel.getStringCellValue().strip() deployables.append(deployable) return deployables
class CIMetadata: """ convenience wrapper to use a simple spreadsheet to acquire metadata for deployment TODO: refactor this """ def __init__(self, wbFile): self.wb = SpreadSheet(wbFile).getSpreadSheet() def getDeployables(self): """ return a list of dicts name : pscname version : version technology : technology packaging : packaging repo-path : path in repo artefact : artefact name target : deploy target security-model : security model """ sheet = self.wb.getSheet("Deployables") rows = sheet.getPhysicalNumberOfRows() deployables = [] for i in range(rows): if not i == 0: row = sheet.getRow(i) deployable = {} if row: name = row.getCell(1) version = row.getCell(0) if name and version: deployable["name"] = row.getCell(1).getStringCellValue().strip() deployable["version"] = row.getCell(0).getStringCellValue().strip() deployable["technology"] = row.getCell(2).getStringCellValue().strip() deployable["packaging"] = row.getCell(3).getStringCellValue().strip() deployable["repo-path"] = row.getCell(5).getStringCellValue().strip() deployable["artefact"] = row.getCell(4).getStringCellValue().strip() target = row.getCell(6) if target: deployable["deploy-target"] = target.getStringCellValue().strip() secModel = row.getCell(7) if secModel: deployable["security-model"] = secModel.getStringCellValue().strip() deployables.append(deployable) return deployables
def __init__(self, wbFile): self.wb = SpreadSheet(wbFile).getSpreadSheet()