コード例 #1
0
# from time import time
# from collections import OrderedDict
# blueprint declaration
deploymentrequestAPI = Blueprint('deploymentrequestAPI', __name__)

deploymentrequestAPINs = api.namespace(
    '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
コード例 #2
0
ファイル: MachineGroupsAPI.py プロジェクト: shyamjin/values
from DBUtil import Machine, Users, MachineGroups, Tags, DeploymentRequestGroup, DeploymentRequest, State, Config
from Services import TeamService, MachineGroupHelperService, HelperServices
from Services.AppInitServices import authService
from settings import mongodb, relative_path
from flask_restplus import Resource
from modules.apimodels import MachineGroupsModel
from modules.apimodels.Restplus import api, header_parser

# blueprint declaration
machineGroupsAPI = Blueprint('MachineGroupsAPI', __name__)
# restplus declaration
machineGroupsAPINs = api.namespace('machinegroups',
                                   description='Machine Groups Operations')
# collections
machineDB = Machine.Machine(mongodb)
tagDB = Tags.Tags()
userdb = Users.Users(mongodb)
machinegroupsDB = MachineGroups.MachineGroups(mongodb)
teamService = TeamService.TeamService()
deploymentRequestGroupDB = DeploymentRequestGroup.DeploymentRequestGroup(
    mongodb)
deploymentRequestDb = DeploymentRequest.DeploymentRequest(mongodb)
stateDb = State.State(mongodb)
configDb = Config.Config(mongodb)


@machineGroupsAPI.route('/machinegroups/add', methods=['POST'])
@authService.authorized
@swag_from(relative_path + '/swgger/MachineGroupsAPI/AddMachineGroups.yml')
def AddMachineGroups():
コード例 #3
0
@author: pdinda
'''
import traceback
from DBUtil import DeploymentFields, DeploymentUnitApprovalStatus, State, DeploymentUnitSet, DeploymentUnit, Counter, DeploymentRequest, Machine
from settings import mongodb
from Services import HelperServices

statedb = State.State(mongodb)
deploymentUnitApprovalStatusdb = DeploymentUnitApprovalStatus.DeploymentUnitApprovalStatus(
)
deploymentFieldsDB = DeploymentFields.DeploymentFields(mongodb)
deploymentunitsetdb = DeploymentUnitSet.DeploymentUnitSet()
deploymentunitdb = DeploymentUnit.DeploymentUnit()
counterDB = Counter.Counter(mongodb)
deploymentrequestdb = DeploymentRequest.DeploymentRequest(mongodb)
machinedb = Machine.Machine(mongodb)


def generate_new_state(details):
    # details has "deployment_field":{"hi":"hellow"} which is handled below
    state_id = None
    deployment_fields_id = None
    dep_fields = None
    try:
        state={"type":"dustate","build_id":details.get("build_id"),\
               "name":details.get("name"),"parent_entity_id":details.get("parent_entity_id")\
               ,"approval_status":"Created"}# DATA VERIFIED IN add_update_state
        if details.get("deployment_field") and len(
                details.get("deployment_field").get("fields", [])) > 0:
            dep_fields = details.get("deployment_field")
        else:
コード例 #4
0
from modules.apimodels import FlexAttributesModel
from DBUtil import FlexibleAttributes, DeploymentUnit, Machine, MachineGroups
from settings import mongodb

faDB = FlexibleAttributes.FlexibleAttributes()
DeploymentUnitDb = DeploymentUnit.DeploymentUnit()
MachineDb = Machine.Machine(mongodb)
MachineGroupsDb = MachineGroups.MachineGroups(mongodb)


def validate_fa(fa_details):
    validate_entity(fa_details['entity'])
    validate_type(fa_details)


def validate_fa_update(fa_details):
    validate_fa(fa_details)
    fa_db_values = faDB.get_by_id(fa_details.get('_id').get('oid'))
    if fa_db_values is None:
        raise Exception("Couldn't find FA with ID: " +
                        fa_details.get('_id').get('oid'))
    if (fa_db_values.get('entity') != fa_details.get('entity')) \
        or (fa_db_values.get('name') != fa_details.get('name')) \
            or (fa_db_values.get('type') != fa_details.get('type')):
        raise Exception(
            "Following fields can't beupdated: entity, name and type")
    for value in fa_db_values.get("valid_values"):
        if value not in fa_details.get("valid_values"):
            if str(fa_details.get('entity')) == "DeploymentUnit":
                for du in DeploymentUnitDb.GetDeploymentUnitByFA(
                        fa_details.get('name')):