def copy_to_storage_server(live_folder, live_repo, update_version=True):
     # live_folder, live_repo = get_live_repository()
     try:
         if Config.get_environment().lower() == 'prod':
             tag = get_last_tag_on_current_commit(live_repo, TRAX_ACE_LIVE)
             if not tag:
                 raise Exception('LiveTagNotExistsOnCurrentCommit')
             if update_version:
                 ProjectDeployment.update_version_file(live_folder, tag)
         tar_file_stream = ProjectDeployment.make_tarfile(live_folder)
         for cloud in CLOUDS:
             print 'bucket name', STORAGE_BUCKET, 'cloud to store', cloud
             storage_connector = StorageFactory.get_connector(
                 mybucket=STORAGE_BUCKET, region='us-east-1', cloud=cloud)
             env = Config.get_environment().lower()
             # deploy the project only in one env
             storage_folder_name = ProjectDeployment.get_trax_ace_live_folder(
                 env)
             print "Uploading file to Remote folder-> {}".format(
                 storage_folder_name)
             DeploymentUtils.save_file_stream(storage_connector,
                                              storage_folder_name,
                                              TAR_FILE_NAME,
                                              tar_file_stream)
     except Exception as e:
         print e
         raise
     finally:
         shutil.rmtree(live_folder)
Beispiel #2
0
 def upload_report_to_s3(self):
     folder_in_s3_bucket = BUCKET_FOLDER
     report_path = os.path.join(tempfile.gettempdir(), self.report_name)
     storage_connector = StorageFactory.get_connector(BUCKET)
     storage_connector.save_file_stream(folder_in_s3_bucket,
                                        self.report_name,
                                        open(report_path, 'r'))
     domain = storage_connector.base_domain[1:]
     file_link = "https://" + domain + "/" + BUCKET + "/" + folder_in_s3_bucket + "/" + self.report_name
     return file_link
 def __init__(self, data_provider, output, **data):
     self.k_engine = BaseCalculationsGroup(data_provider, output)
     self.data_provider = data_provider
     self.project_name = self.data_provider.project_name
     self.session_uid = self.data_provider.session_uid
     self.scif = self.data_provider[Data.SCENE_ITEM_FACTS]
     self.all_products = self.data_provider[Data.ALL_PRODUCTS]
     self.survey_response = self.data_provider[Data.SURVEY_RESPONSES]
     self.kpi_static_data = data.get('kpi_static_data')
     self.match_display_in_scene = data.get('match_display_in_scene')
     self.general_tools = CCBOTTLERSUS_SANDBCIGENERALToolBox(data_provider, output, self.kpi_static_data, geometric_kpi_flag=True)
     self.amz_conn = StorageFactory.get_connector(BUCKET)
     self.templates_path = self.TEMPLATES_PATH + self.project_name + '/'
     self.cloud_templates_path = '{}{}/{}'.format(self.TEMPLATES_PATH, self.project_name, {})
     self.local_templates_path = os.path.join(CACHE_PATH, 'templates')
    def __init__(self, data_provider, output, **kwargs):
        self.k_engine = BaseCalculationsGroup(data_provider, output)
        self.data_provider = data_provider
        self.project_name = self.data_provider.project_name
        self.session_uid = self.data_provider.session_uid
        self.scif = self.data_provider[Data.SCENE_ITEM_FACTS]
        self.all_products = self.data_provider[Data.ALL_PRODUCTS]
        self.survey_response = self.data_provider[Data.SURVEY_RESPONSES]
        self.amz_conn = StorageFactory.get_connector(BUCKET)
        self.templates_path = self.TEMPLATES_PATH + self.project_name + '/'
        self.local_templates_path = os.path.join(CACHE_PATH, 'templates')
        self.cloud_templates_path = '{}{}/{}'.format(self.TEMPLATES_PATH, self.project_name, {})

        for data in kwargs.keys():
            setattr(self, data, kwargs[data])
Beispiel #5
0
 def amz_conn(self):
     if not hasattr(self, '_amz_conn'):
         self._amz_conn = StorageFactory.get_connector(BUCKET)
     return self._amz_conn