Tests/store_packs.py
def format_metadata(self, pack_content_items, integration_images, author_image):
        """Re-formats metadata according to marketplace metadata format defined in issue #19786 and writes back
        the result.

        Args:
            pack_content_items (dict): content items that are located inside specific pack. Possible keys of the dict:
            Classifiers, Dashboards, IncidentFields, IncidentTypes, IndicatorFields, Integrations, Layouts, Playbooks,
            Reports, Scripts and Widgets. Each key is mapped to list of items with name and description. Several items
            have no description.
            integration_images (list): list of uploaded integration images with integration display name and image gcs
            public url.
            author_image (str): uploaded public gcs path to author image.

        Returns:
            bool: True is returned in case metadata file was parsed successfully, otherwise False.

        """
        user_metadata_path = os.path.join(self._pack_path, Pack.USER_METADATA)  # user metadata path before parsing
        metadata_path = os.path.join(self._pack_path, Pack.METADATA)  # deployed metadata path after parsing

        if not os.path.exists(user_metadata_path):
            print_error(f"{self._pack_name} pack is missing {Pack.USER_METADATA} file.")
            return False

        with open(user_metadata_path, "r") as user_metadata_file:
            user_metadata = json.load(user_metadata_file)  # loading user metadata
            formatted_metadata = Pack._parse_pack_metadata(user_metadata=user_metadata,
                                                           pack_content_items=pack_content_items,
                                                           pack_id=self._pack_name,
                                                           integration_images=integration_images,
                                                           author_image=author_image)

        with open(metadata_path, "w") as metadata_file:
            json.dump(formatted_metadata, metadata_file, indent=4)  # writing back parsed metadata

        print_color(f"Finished formatting {self._pack_name} packs's {Pack.METADATA} {metadata_path} file.",
                    LOG_COLORS.GREEN)
        return True
Re-formats metadata according to marketplace metadata format defined in issue #19786 and writes back
        the result.

        Args:
            pack_content_items (dict): content items that are located inside specific pack. Possible keys of the dict:
            Classifiers, Dashboards, IncidentFields, IncidentTypes, IndicatorFields, Integrations, Layouts, Playbooks,
            Reports, Scripts and Widgets. Each key is mapped to list of items with name and description. Several items
            have no description.
            integration_images (list): list of uploaded integration images with integration display name and image gcs
            public url.
            author_image (str): uploaded public gcs path to author image.

        Returns:
            bool: True is returned in case metadata file was parsed successfully, otherwise False.

        
Re-formats metadata according to marketplace metadata format defined in issue #19786 and writes back
the result.

pack_content_items (dict): content items that are located inside specific pack. Possible keys of the dict:
Classifiers, Dashboards, IncidentFields, IncidentTypes, IndicatorFields, Integrations, Layouts, Playbooks,
Reports, Scripts and Widgets. Each key is mapped to list of items with name and description. Several items
have no description.
integration_images (list): list of uploaded integration images with integration display name and image gcs
public url.
author_image (str): uploaded public gcs path to author image.

True is returned in case metadata file was parsed successfully, otherwise False.
Re - formats metadata according to marketplace metadata format defined in issue #19786 and writes back the result . pack_content_items ( dict ) : content items that are located inside specific pack . Possible keys of the dict : Classifiers Dashboards IncidentFields IncidentTypes IndicatorFields Integrations Layouts Playbooks Reports Scripts and Widgets . Each key is mapped to list of items with name and description . Several items have no description . integration_images ( list ) : list of uploaded integration images with integration display name and image gcs public url . author_image ( str ) : uploaded public gcs path to author image . True is returned in case metadata file was parsed successfully otherwise False .
def format_metadata(self, pack_content_items, integration_images, author_image):
        user_metadata_path = os.path.join(self._pack_path, Pack.USER_METADATA)  
        metadata_path = os.path.join(self._pack_path, Pack.METADATA)  
        if not os.path.exists(user_metadata_path):
            print_error(f"{self._pack_name} pack is missing {Pack.USER_METADATA} file.")
            return False
        with open(user_metadata_path, "r") as user_metadata_file:
            user_metadata = json.load(user_metadata_file)  
            formatted_metadata = Pack._parse_pack_metadata(user_metadata=user_metadata,
                                                           pack_content_items=pack_content_items,
                                                           pack_id=self._pack_name,
                                                           integration_images=integration_images,
                                                           author_image=author_image)
        with open(metadata_path, "w") as metadata_file:
            json.dump(formatted_metadata, metadata_file, indent=4)  
        print_color(f"Finished formatting {self._pack_name} packs's {Pack.METADATA} {metadata_path} file.",
                    LOG_COLORS.GREEN)
        return True
def format_metadata ( self , pack_content_items , integration_images , author_image ) : user_metadata_path = os . path . join ( self . _pack_path , Pack . USER_METADATA ) metadata_path = os . path . join ( self . _pack_path , Pack . METADATA ) if not os . path . exists ( user_metadata_path ) : print_error ( f"{self._pack_name} pack is missing {Pack.USER_METADATA} file." ) return False with open ( user_metadata_path , "r" ) as user_metadata_file : user_metadata = json . load ( user_metadata_file ) formatted_metadata = Pack . _parse_pack_metadata ( user_metadata = user_metadata , pack_content_items = pack_content_items , pack_id = self . _pack_name , integration_images = integration_images , author_image = author_image ) with open ( metadata_path , "w" ) as metadata_file : json . dump ( formatted_metadata , metadata_file , indent = 4 ) print_color ( f"Finished formatting {self._pack_name} packs's {Pack.METADATA} {metadata_path} file." , LOG_COLORS . GREEN ) return True
Re-formats metadata according to marketplace metadata format defined in issue #19786 and writes back
the result.
Re - formats metadata according to marketplace metadata format defined in issue #19786 and writes back the result .
"""Re-formats metadata according to marketplace metadata format defined in issue #19786 and writes back
        the result.

        Args:
            pack_content_items (dict): content items that are located inside specific pack. Possible keys of the dict:
            Classifiers, Dashboards, IncidentFields, IncidentTypes, IndicatorFields, Integrations, Layouts, Playbooks,
            Reports, Scripts and Widgets. Each key is mapped to list of items with name and description. Several items
            have no description.
            integration_images (list): list of uploaded integration images with integration display name and image gcs
            public url.
            author_image (str): uploaded public gcs path to author image.

        Returns:
            bool: True is returned in case metadata file was parsed successfully, otherwise False.

        """ # user metadata path before parsing # deployed metadata path after parsing # loading user metadata # writing back parsed metadata
self
pack_content_items
integration_images
author_image