Пример #1
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()
Пример #2
0
 def __init__(self):
     self.db = mongodb
     self.current_import_path = import_full_path
     if not os.path.exists(self.current_import_path):
         os.makedirs(self.current_import_path)
     if not os.access(self.current_import_path, os.W_OK):
         raise ValueError(
             "The directory does not have write access :" + self.current_import_path)
     self.configdb = Config.Config(self.db)
     self.syncdb = Sync.Sync(self.db)
     self.syncRequestdb = SyncRequest.SyncRequest(self.db)
     self.mailer = Mailer.Mailer()
     self.syncService = SyncServices.SyncServices()
     self.systemDetailsDb = SystemDetails.SystemDetails(self.db)
     self.systemDetail = self.systemDetailsDb.get_system_details_single()
     self.remoteAuthenticationService = RemoteAuthenticationService.RemoteAuthenticationService()
     if not self.systemDetail:
         raise Exception("systemDeatils not found")
     if not self.systemDetail.get("hostname"):
         raise Exception("hostname not found in systemDeatils")
     self.host_name = self.systemDetail.get("hostname")
     self.post_url = "/sync/pull/export"
     self.config_id = 10
     self.count_of_files = 2  # Minimum Threads is 2
     self.load_configuration()
     self.schedulerService = SchedulerService.SchedulerService()
Пример #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()
Пример #4
0
 def __init__(self):
     self.db = mongodb
     self.current_path = export_full_path
     if not os.path.exists(self.current_path):
         os.makedirs(self.current_path)
     if not os.access(os.path.dirname(self.current_path), os.W_OK):
         raise ValueError("The directory does not have write access :" +
                          self.current_path)
     self.remoteAuthenticationService = RemoteAuthenticationService.RemoteAuthenticationService(
     )
     self.configdb = Config.Config(self.db)
     self.syncdb = Sync.Sync(self.db)
     self.syncRequestdb = SyncRequest.SyncRequest(self.db)
     self.syncService = SyncServices.SyncServices()
     self.remote_import_path = None
     self.count_of_files = 2  # Minimum Threads is 2
     self.allow_split = "true"  # Default split allowed
     self.config_id = 11
     self.load_configuration()
     self.schedulerService = SchedulerService.SchedulerService()
Пример #5
0
import unittest
import requests

from GetAuthToken import getToken
import json
from settings import mongodb, unittest_test_url
from DBUtil import Sync, Versions
import verifyResponse

Syncdb = Sync.Sync(mongodb)
Baseurl = unittest_test_url + "sync/"
header = {'content-type': "application/json", 'token': str(getToken())}


class SyncViewAllTest(unittest.TestCase):
    sync_id = None

    def runTest(self):
        url = Baseurl + "view/all"
        print "--------------------------------------------------------------------------------------------------------"
        print "Calling API :" + url + " For Sync view all test"
        response = requests.request("GET", url, headers=header, verify=False)
        verifyResponse.PositiveTesting(response)
        json_data = json.loads(response.text)
        data = json_data.get("data").get("data")
        rec = data[0]
        SyncViewAllTest.sync_id = rec.get("sync_id")


class GetBySyncIdTest(unittest.TestCase):
    def runTest(self):
Пример #6
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:
Пример #7
0
 def __init__(self):
     self.db = mongodb
     self.current_import_path = import_full_path
     self.current_export_path = export_full_path
     self.config_id = 9
     self.syncDb = Sync.Sync(self.db)
Пример #8
0
# get global db connection
db = mongodb

# blueprint declaration
syncAPI = Blueprint('syncAPI', __name__)
# restPlus Declaration
syncAPINs = api.namespace('sync', description='Sync Operations',path="/sync")


# get global db connection
db = mongodb

# collection

syncDb = Sync.Sync(db)
userDb = Users.Users(db)
configDb = Config.Config(db)
cleanerServices = CleanerServices.CleanerServices(mongodb)


SavedExportsDb = SavedExports.SavedExports()
syncRequestDb = SyncRequest.SyncRequest(db)
syncService = SyncServices.SyncServices()
pullService = PullServices.PullServices()
pushService = PushServices.PushServices()

@syncAPINs.route('/savedexports', methods=['GET'])
class get_saved_exports(Resource):
    @api.expect(header_parser, validate=True)
    @api.marshal_with(SyncAPIModel.get_saved_exports_response_model)