Tests/store_packs.py
def upload_integration_images(self, storage_bucket):
        """Uploads pack integrations images to gcs.

        The returned result of integration section are defined in issue #19786.

        Args:
            storage_bucket (google.cloud.storage.bucket.Bucket): google storage bucket where image will be uploaded.

        Returns:
            bool: whether the operation succeeded.
            list: list of dictionaries with uploaded pack integration images.

        """
        task_status = True
        uploaded_integration_images = []

        try:
            pack_local_images = self._search_for_images(target_folder=INTEGRATIONS_FOLDER)

            if not pack_local_images:
                return uploaded_integration_images  # returned empty list if not images found

            pack_storage_root_path = os.path.join(STORAGE_BASE_PATH, self._pack_name)

            for image_data in pack_local_images:
                image_local_path = image_data.get('repo_image_path')
                image_name = os.path.basename(image_local_path)
                image_storage_path = os.path.join(pack_storage_root_path, image_name)
                pack_image_blob = storage_bucket.blob(image_storage_path)

                with open(image_local_path, "rb") as image_file:
                    pack_image_blob.upload_from_file(image_file)
                    uploaded_integration_images.append({
                        'name': image_data.get('display_name', ''),
                        'imagePath': pack_image_blob.name if USE_GCS_RELATIVE_PATH else pack_image_blob.public_url
                    })

            print(f"Uploaded {len(pack_local_images)} images for {self._pack_name} pack.")
        except Exception as e:
            task_status = False
            print_error(f"Failed to upload {self._pack_name} pack integration images. Additional info:\n {e}")
        finally:
            return task_status, uploaded_integration_images
Uploads pack integrations images to gcs.

        The returned result of integration section are defined in issue #19786.

        Args:
            storage_bucket (google.cloud.storage.bucket.Bucket): google storage bucket where image will be uploaded.

        Returns:
            bool: whether the operation succeeded.
            list: list of dictionaries with uploaded pack integration images.

        
Uploads pack integrations images to gcs.
The returned result of integration section are defined in issue #19786.
Uploads pack integrations images to gcs . The returned result of integration section are defined in issue #19786 .
def upload_integration_images(self, storage_bucket):
        task_status = True
        uploaded_integration_images = []
        try:
            pack_local_images = self._search_for_images(target_folder=INTEGRATIONS_FOLDER)
            if not pack_local_images:
                return uploaded_integration_images  
            pack_storage_root_path = os.path.join(STORAGE_BASE_PATH, self._pack_name)
            for image_data in pack_local_images:
                image_local_path = image_data.get('repo_image_path')
                image_name = os.path.basename(image_local_path)
                image_storage_path = os.path.join(pack_storage_root_path, image_name)
                pack_image_blob = storage_bucket.blob(image_storage_path)
                with open(image_local_path, "rb") as image_file:
                    pack_image_blob.upload_from_file(image_file)
                    uploaded_integration_images.append({
                        'name': image_data.get('display_name', ''),
                        'imagePath': pack_image_blob.name if USE_GCS_RELATIVE_PATH else pack_image_blob.public_url
                    })
            print(f"Uploaded {len(pack_local_images)} images for {self._pack_name} pack.")
        except Exception as e:
            task_status = False
            print_error(f"Failed to upload {self._pack_name} pack integration images. Additional info:\n {e}")
        finally:
            return task_status, uploaded_integration_images
def upload_integration_images ( self , storage_bucket ) : task_status = True uploaded_integration_images = [ ] try : pack_local_images = self . _search_for_images ( target_folder = INTEGRATIONS_FOLDER ) if not pack_local_images : return uploaded_integration_images pack_storage_root_path = os . path . join ( STORAGE_BASE_PATH , self . _pack_name ) for image_data in pack_local_images : image_local_path = image_data . get ( 'repo_image_path' ) image_name = os . path . basename ( image_local_path ) image_storage_path = os . path . join ( pack_storage_root_path , image_name ) pack_image_blob = storage_bucket . blob ( image_storage_path ) with open ( image_local_path , "rb" ) as image_file : pack_image_blob . upload_from_file ( image_file ) uploaded_integration_images . append ( { 'name' : image_data . get ( 'display_name' , '' ) , 'imagePath' : pack_image_blob . name if USE_GCS_RELATIVE_PATH else pack_image_blob . public_url } ) print ( f"Uploaded {len(pack_local_images)} images for {self._pack_name} pack." ) except Exception as e : task_status = False print_error ( f"Failed to upload {self._pack_name} pack integration images. Additional info:\n {e}" ) finally : return task_status , uploaded_integration_images
Uploads pack integrations images to gcs.
Uploads pack integrations images to gcs .
"""Uploads pack integrations images to gcs.

        The returned result of integration section are defined in issue #19786.

        Args:
            storage_bucket (google.cloud.storage.bucket.Bucket): google storage bucket where image will be uploaded.

        Returns:
            bool: whether the operation succeeded.
            list: list of dictionaries with uploaded pack integration images.

        """ # returned empty list if not images found
whether the operation succeeded.
list: list of dictionaries with uploaded pack integration images.
whether the operation succeeded . list : list of dictionaries with uploaded pack integration images .
bool
self
storage_bucket
google storage bucket where image will be uploaded.
google storage bucket where image will be uploaded .