示例#1
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()
示例#2
0
from flask import Blueprint, jsonify, request
from DBUtil import State, DeploymentUnitApprovalStatus, DeploymentFields, DeploymentUnit, DeploymentUnitSet, Build
from Services import HelperServices, StateHelperService
from Services.AppInitServices import authService
from settings import mongodb, relative_path

# blueprint declaration
stateAPI = Blueprint('stateAPI', __name__)
# get global db connection
db = mongodb

# collection
statedb = State.State(db)
deploymentUnitApprovalStatusdb = DeploymentUnitApprovalStatus.DeploymentUnitApprovalStatus(
)
deploymentFieldsdb = DeploymentFields.DeploymentFields(db)
deploymentUnitdb = DeploymentUnit.DeploymentUnit()
deploymentUnitSetdb = DeploymentUnitSet.DeploymentUnitSet()
buildDB = Build.Build()
'''
{
    "data": {
        "page_total": 2,
        "total": 2,
        "data": [
            {
                "build_id": "59fae88cf6a8881077056569",
                "name": "Test 100 State-539",
                "parent_entity_id": "59fac998721561006abadb9b",
                "parent_entity_name": "Test 100",
                "_id": {
示例#3
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:
示例#4
0
# blueprint declaration
deploymentUnitAPI = Blueprint('deploymentUnitAPI', __name__)
#restplus delaration
deploymentUnitAPINs = api.namespace('deploymentunit',
                                    description='Deployment Unit Operations')

# get global db connection
db = mongodb
deploymentUnitDB = DeploymentUnit.DeploymentUnit()
tagDB = Tags.Tags()
buildDB = Build.Build()
deploymentUnitApprovalStatusDB = DeploymentUnitApprovalStatus.DeploymentUnitApprovalStatus(
)
deploymentUnitSetDB = DeploymentUnitSet.DeploymentUnitSet()
deploymentFieldsDB = DeploymentFields.DeploymentFields(db)
teamService = TeamService.TeamService()
toolsonmachinedb = ToolsOnMachine.ToolsOnMachine(db)
deploymentRequestDB = DeploymentRequest.DeploymentRequest(db)
stateDB = State.State(db)
deploymentUnitTypeDB = DeploymentUnitType.DeploymentUnitType()


@deploymentUnitAPI.route('/deploymentunit/all', methods=['GET'])
@authService.authorized
@swag_from(relative_path +
           '/swgger/DeploymentUnitAPI/getAllDeploymentUnits.yml')
def getAllDeploymentUnits():

    id_list = teamService.get_user_permissions(
        authService.get_userid_by_auth_token())[