Exemplo n.º 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()
Exemplo n.º 2
0
from flask import Blueprint, jsonify, request
from DBUtil import Build, Users, SystemDetails, State, Config
from settings import mongodb, default_nexus_container_name, temp_files_full_path
from Services import StateHelperService, BuildHelperService, HelperServices
from Services.AppInitServices import authService
import os
import json
# blueprint declaration
buildAPI = Blueprint('buildAPI', __name__)

# get global db connection
db = mongodb
buildDB = Build.Build()
userDB = Users.Users(db)
systemDetailsDB = SystemDetails.SystemDetails(db)
stateDb = State.State(mongodb)
configDb = Config.Config(mongodb)
'''
INPUT REQUEST:
{ 
    "_id" : ObjectId("5abbc6749e53f700787d3997"), 
    "status" : "1",
    "file_size" : "4.0K", 
    "type" : "url", 
    "file_path" : "http://illin4490:8081/nexus/content/repositories/yum-test/com/amdocs/core/crm/crm-playbooks/10.2.4-1620/crm-playbooks-10.2.4-1620.tar",
    "build_number": 22, 
    "package_name" : "crm-playbooks-10.2.4-1620.tar", 
    "package_type" : "tar", 
    "parent_entity_id" : "5abbbf5ff13a94007945f01a",   
    "additional_artifacts" : {
        "artifacts" : [
Exemplo n.º 3
0
import re
from bson.json_util import dumps
from flasgger import swag_from, validate, ValidationError
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",
Exemplo n.º 4
0
'''
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:
            if key not in data.keys():
                raise ValueError("Deployment field key: " + key +
                                 " was not found for:" +
                                 data.get("input_name"))
Exemplo n.º 5
0
from modules.apimodels.Restplus import api, header_parser
from modules.apimodels.GenericReponseModel import generic_post_response_model, generic_response_model

# blueprint declaration
deploymentUnitSetAPI = Blueprint('deploymentUnitSetAPI', __name__)

deploymentUnitSetAPINs = api.namespace(
    'deploymentunitset', description='Deployment Unit Set Operations')
# get global db connection
db = mongodb
deploymentUnitSetDB = DeploymentUnitSet.DeploymentUnitSet()
userDB = Users.Users(db)
systemDetailsDB = SystemDetails.SystemDetails(db)
teamService = TeamService.TeamService()
deploymentUnitDB = DeploymentUnit.DeploymentUnit()
stateDB = State.State(db)


@deploymentUnitSetAPI.route('/deploymentunitset/all', methods=['GET'])
@authService.authorized
@swag_from(relative_path +
           '/swgger/DeploymentUnitSetAPI/getAllDeploymentUnitSets.yml')
def getAllDeploymentUnitSets():

    limit = int(request.args.get('perpage', '30'))
    page = int(request.args.get('page', "0"))
    skip = page * limit
    tags_filter = []
    duName_filter = []
    approval_status_filter = []
    name_filter = None
Exemplo n.º 6
0
Created on Dec 18, 2017

@author: pdinda
'''

import os,shutil,traceback
from datetime import datetime
from DBUtil import Build,State,Repository
from settings import mongodb
from Services import HelperServices,CustomClassLoaderService
from Services import ExternalRepoDownloadHelper



buildsDB = Build.Build()
stateDB=State.State(mongodb)
repositoryDB=Repository.Repository()

def get_build_for_parent(parent_entity_id, build_id=None,state_id=None,build_number=None):
    '''
    General description:
    Args:
    param1 (object_id) : This is the ID of the existing \
       Build which we have to set active.
       parent_entity_id(object) : This is the parameter which has details of Build.
    Returns:
             Returns the count of the records set active successfully \
             for the given id of the build.
    Example :
         get_build_for_parent(parent_entity_id, build_id,state_id,build_number)
    '''