def __init__(self): """Initializing Variable """ self.db = mongodb self.distributionSync = DistributionSync.DistributionSync(self.db) self.toolDB = Tool.Tool(self.db) self.versionsDB = Versions.Versions(self.db) self.mailer = Mailer.Mailer() self.static_folder_path = current_path self.current_import_path = distribution_center_import_full_path self.current_import_small_path = distribution_center_import_path if self.current_import_path in [None, ""]: raise ValueError("Import path was not provided") if not os.path.exists(self.current_import_path): os.makedirs(self.current_import_path) if not os.access(os.path.dirname(self.current_import_path), os.W_OK): raise ValueError("The directory does not have write access :" + self.current_import_path) self.current_export_path = distribution_center_export_full_path if self.current_export_path in [None, ""]: raise ValueError("Export path was not provided") if not os.path.exists(self.current_export_path): os.makedirs(self.current_export_path) if not os.access(os.path.dirname(self.current_export_path), os.W_OK): raise ValueError("The directory does not have write access :" + self.current_export_path) self.configdb = Config.Config(self.db) self.logo_path = logo_path self.full_logo_path = logo_full_path self.media_files_path = media_path self.full_media_files_path = media_full_path self.config_id = 13 self.load_configuration() self.schedulerService = SchedulerService.SchedulerService()
def __init__(self, db): ''' General description : This function initializes the database variables and \ index to refer in functions. ''' self.db = db self.configdb = Config.Config(db) self.toolDB = Tool.Tool(self.db) self.userDB = Users.Users(self.db) self.roleDB = Role.Role(self.db) self.buildsDB = Build.Build() self.versionsDB = Versions.Versions(db) self.emailsDB = Emails.Emails(self.db) self.deploymentRequestDB = DeploymentRequest.DeploymentRequest(db) self.CloneRequestDB = CloneRequest.CloneRequest(db) self.contributionGitPushLogs = ContributionGitPushLogs.ContributionGitPushLogs( db) self.sync = Sync.Sync(db) self.auditingDB = Auditing.Auditing() self.distributionSync = DistributionSync.DistributionSync(db) self.mediaFilesDB = MediaFiles.MediaFiles(self.db) self.logo_path = logo_path self.full_logo_path = str(current_path) + self.logo_path self.media_files_path = media_path self.full_media_files_path = media_full_path self.folder_list_to_clean = [ export_full_path, distribution_center_export_full_path ] self.config_id = 15 self.load_configuration() self.schedulerService = SchedulerService.SchedulerService() self.deploymentUnitDB = DeploymentUnit.DeploymentUnit() self.repositoryDB = Repository.Repository()
def __init__(self): self.versionsDB = Versions.Versions(mongodb) self.toolDB = Tool.Tool(mongodb) self.tagDB = Tags.Tags() self.toolsetdb = ToolSet.ToolSet(mongodb) self.deploymentunitsetdb = DeploymentUnitSet.DeploymentUnitSet() self.deploymentunitdb = DeploymentUnit.DeploymentUnit() self.teamDB = Teams.Teams(mongodb) self.machineDB = Machine.Machine(mongodb) self.machinegroupsDB = MachineGroups.MachineGroups(mongodb) self.toolsetdb = ToolSet.ToolSet(mongodb) self.userdb = Users.Users(mongodb) self.roledb = Role.Role(mongodb)
def __init__(self): self.db = mongodb self.current_import_path = import_full_path if self.current_import_path in [None, ""]: raise ValueError("Import path was not provided") if not os.path.exists(self.current_import_path): os.makedirs(self.current_import_path) if not os.access(os.path.dirname(self.current_import_path), os.W_OK): raise ValueError("The directory does not have write access :" + self.current_import_path) self.current_export_path = export_full_path if self.current_export_path in [None, ""]: raise ValueError("Export path was not provided") if not os.path.exists(self.current_export_path): os.makedirs(self.current_export_path) if not os.access(os.path.dirname(self.current_export_path), os.W_OK): raise ValueError("The directory does not have write access :" + self.current_export_path) self.configdb = Config.Config(self.db) self.versionsDB = Versions.Versions(self.db) self.toolDB = Tool.Tool(self.db) self.deploymentFieldsDB = DeploymentFields.DeploymentFields(self.db) self.machineDB = Machine.Machine(self.db) self.syncDb = Sync.Sync(self.db) self.mailer = Mailer.Mailer() self.syncRequestDb = SyncRequest.SyncRequest(self.db) self.buildsDB = Build.Build() self.documentsDB = Documents.Documents(self.db) self.toolDB = Tool.Tool(self.db) self.deploymentunitDB = DeploymentUnit.DeploymentUnit() self.deploymentunitsetDB = DeploymentUnitSet.DeploymentUnitSet() self.mediaFilesDB = MediaFiles.MediaFiles(self.db) self.tagsDB = Tags.Tags() self.preRequisitesDB = PreRequisites.PreRequisites(self.db) self.logo_path = logo_path self.full_logo_path = logo_full_path self.media_files_path = media_path self.full_media_files_path = media_full_path self.systemDetailsDb = SystemDetails.SystemDetails(self.db) self.systemDetail = self.systemDetailsDb.get_system_details_single() self.statedb = State.State(self.db) if not self.systemDetail: raise Exception("systemDeatils not found") self.config_id = 9 self.load_configuration() self.schedulerService = SchedulerService.SchedulerService() self.flexAttrDB = FlexibleAttributes.FlexibleAttributes()
def __init__(self, db): ''' General description : This function initializes the database variables and \ index to refer in functions. ''' self.configdb = Config.Config(db) self.toolDb = Tool.Tool(db) self.versionsDb = Versions.Versions(db) self.contributionGitPushLogsDb = \ ContributionGitPushLogs.ContributionGitPushLogs(db) self.mailer = Mailer.Mailer() self.systemDetailsDb = SystemDetails.SystemDetails(db) self.config_id = 14 self.load_configuration() self.schedulerService = SchedulerService.SchedulerService()
db = mongodb # collection configdb = Config.Config(db) distributionCenterConfig = configdb.getConfigByName("PushServices") # collections cloneRequestDB = CloneRequest.CloneRequest(db) machineDB = Machine.Machine(db) distributionMachinetDB = DistributionMachine.DistributionMachine(db) if distributionCenterConfig: distributionCenterService = DistributionCenterService.DistributionCenterService( db) distributionsyncDB = DistributionSync.DistributionSync(db) tooldb = Tool.Tool(db) versionsDB = Versions.Versions(db) accountDB = Accounts.Accounts() distributionMachinetDB = DistributionMachine.DistributionMachine(db) # classes @distributionCenterAPI.route('/clonerequest/distribution/all', methods=['GET']) @authService.authorized @swag_from( relative_path + '/swgger/DistributionCenterAPI/getAllDistributionCenterDistribution.yml') def getAllDistributionCenterDistribution(): result = [] request_data = distributionMachinetDB.GetDistributionMachineAll() if request_data: for rec in request_data:
from datetime import datetime import os, json, shutil, subprocess, traceback from DBUtil import ProposedTools, Tool, Config, SystemDetails, Versions, Repository from settings import mongodb, proposed_tool_git_full_path,\ proposed_tool_jenkins_full_path,logo_path, logo_full_path, current_path from Services import Mailer, HelperServices from modules import ToolAPI #DB proposedToolsDB = ProposedTools.ProposedTools() toolDB = Tool.Tool(mongodb) configdb = Config.Config(mongodb) sysdetailsDB = SystemDetails.SystemDetails(mongodb) system_details = sysdetailsDB.get_system_details_single() tooldb = Tool.Tool(mongodb) versionsDB = Versions.Versions(mongodb) RepositoryDB = Repository.Repository() #SERVICES mailer = Mailer.Mailer() def email_tool_proposed(pt_details): mailer.send_html_notification( pt_details.get("support_details"), None, None, 17, { "name": pt_details.get("name"), "machine_host": system_details.get("hostname") }) def email_approval_req(pt_details): proposed_tool_support_email = configdb.getConfigByName(
import time from GetAuthToken import getToken import json from settings import mongodb,unittest_test_url from DBUtil import DeploymentRequestGroup,MachineType,Machine,Versions,Tool,Config,Build,MachineGroups,DeploymentUnitSet import verifyResponse DeploymentUnitSetDb=DeploymentUnitSet.DeploymentUnitSet() MachineGroupsDb=MachineGroups.MachineGroups(mongodb) BuildDb=Build.Build() ToolDb=Tool.Tool(mongodb) ConfigDb = Config.Config(mongodb) MachineDb=Machine.Machine(mongodb) MachineTypeDb=MachineType.MachineType(mongodb) VersionsDb=Versions.Versions(mongodb) DeploymentRequestGroupdb=DeploymentRequestGroup.DeploymentRequestGroup(mongodb) Baseurl = unittest_test_url+"deploymentrequest/group/" header = {'content-type': "application/json", 'token':str(getToken())} class AddDepGroupReqTest(unittest.TestCase): oid=None; def runTest(self): url=Baseurl+"add" print "--------------------------------------------------------------------------------------------------------" print "Calling API :"+url + " For Create Deployment Group Request test" payload={"deployment_requests":[{"parent_entity_id":str(VersionsDb.get_last_active_version_by_tool_id(str(ToolDb.get_tool_by_name("jTrace").get("_id")),False).get("_id")), "requested_by":"SuperAdmin", "request_type":"deploy", "deployment_type":"toolgroup",
import unittest import requests from GetAuthToken import getToken import json from settings import mongodb, unittest_test_url from DBUtil import Tool, Versions import verifyResponse Tooldb = Tool.Tool(mongodb) Versionsdb = Versions.Versions(mongodb) Baseurl = unittest_test_url + "tool/" header = {'content-type': "application/json", 'token': str(getToken())} class AddToolTest(unittest.TestCase): oid = None version_id = None def runTest(self): url = Baseurl + "add" print "--------------------------------------------------------------------------------------------------------" print "Calling API :" + url + " For Create tool test" payload = { "name": "UnitTestTool", "tag": [], "support_details": "*****@*****.**", "description": "TEST", "version": { "version_date": "2018-02-16 14:44:47.021 ", "version_name": "1",