Ejemplo n.º 1
0
 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()
Ejemplo n.º 2
0
 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()
Ejemplo n.º 3
0
 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()
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
    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()
Ejemplo n.º 6
0
# get global db connection
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:
Ejemplo n.º 7
0
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(
Ejemplo n.º 8
0
import unittest
import requests
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",
Ejemplo n.º 9
0
'''
Created on Jul 20, 2016

@author: pdinda
'''
import shutil, re, string, random
from DBUtil import Versions, Tool, DeploymentFields, Sync, \
     Documents, MediaFiles,DeploymentUnit,Config,ExitPointPlugins,State
from settings import mongodb

configdb = Config.Config(mongodb)
versionsDB = Versions.Versions(mongodb)
toolDB = Tool.Tool(mongodb)
deploymentFieldsDB = DeploymentFields.DeploymentFields(mongodb)
syncDb = Sync.Sync(mongodb)
documentsDB = Documents.Documents(mongodb)
mediaFilesDB = MediaFiles.MediaFiles(mongodb)
deploymentunitdb = DeploymentUnit.DeploymentUnit()
exitPointPlugins = ExitPointPlugins.ExitPointPlugins()
statedb = State.State(mongodb)


def add_update_deployment_fields(deploymentFieldData, parent_entity_id):
    """Add Update a DeploymentField"""
    Deploymentinsert = {}
    Deploymentinsert['parent_entity_id'] = parent_entity_id
    Deploymentinsert['fields'] = deploymentFieldData
    for data in deploymentFieldData:
        keys_to_check = ["input_name", "input_type"]
        keys_whose_value_cannot_empty = ["input_name", "input_type"]
        for key in keys_to_check:
Ejemplo n.º 10
0
deploymentunitdb = DeploymentUnit.DeploymentUnit()
machinegroupdb = MachineGroups.MachineGroups(mongodb)
distributionmachinetdb = DistributionMachine.DistributionMachine(mongodb)
clonerequestdb = CloneRequest.CloneRequest(mongodb)
toolsonmachinedb = ToolsOnMachine.ToolsOnMachine(mongodb)
machineFavDb = UserFavoriteMachine.UserFavoriteMachine(mongodb)
machineTypeDb = MachineType.MachineType(mongodb)
accountDB = Accounts.Accounts()
machineDB = Machine.Machine(mongodb)
tagDB = Tags.Tags()
teamsDb = Teams.Teams(mongodb)
teamService = TeamService.TeamService()
machinegroupDB = MachineGroups.MachineGroups(mongodb)
userdb = Users.Users(mongodb)
distributionMachinetDB = DistributionMachine.DistributionMachine(mongodb)
tooldb = Tool.Tool(mongodb)
versionsDB = Versions.Versions(mongodb)
buildDB = Build.Build()


def delete_machine(machine_id):
    """Start Machine Deletion"""

    if machinedb.GetMachine(machine_id) is None:
        raise ValueError("Machine does not exists")
    machinegroups = machinegroupdb.get_all_machine_groups(
        {"machine_id_list": {
            "$in": [str(machine_id)]
        }})
    present_in_machinegroups = []
    for machinegroup in machinegroups:
Ejemplo n.º 11
0
    'deploymentrequest', description='Deployment Request Operations')
# get global db connection
db = mongodb

# collections

deploymentRequestDB = DeploymentRequest.DeploymentRequest(db)
deploymentRequestGroupDB = DeploymentRequestGroup.DeploymentRequestGroup(db)
machineDB = Machine.Machine(db)
versionsDB = Versions.Versions(db)
machinegroupsDB = MachineGroups.MachineGroups(db)
toolSetDB = ToolSet.ToolSet(db)
deploymentRequestService = DeploymentRequestService.DeploymentRequestService(
    db)
deploymentUnitDB = DeploymentUnit.DeploymentUnit()
toolDB = Tool.Tool(db)
statedb = State.State(db)


@deploymentrequestAPI.route('/deploymentrequest/deploymentfield/upload',
                            methods=['POST'])
@authService.authorized
def upload_csv_json_file():
    # This is the path to the upload directory
    try:
        # Get the name of the uploaded file
        file = request.files['file']
        if file is None:
            raise ValueError("No file selected")
        # Check if the file is one of the allowed types/extensions
        if (file.filename.rsplit('.', 1)[1] in ['csv']):