def execute()

in ees_sharepoint/deletion_sync_command.py [0:0]


    def execute(self):
        """Runs the deletion sync logic"""
        logger = self.logger
        logger.info("Running deletion sync")

        try:
            with open(IDS_PATH) as file:
                ids = json.load(file)
            for collection in self.config.get_value('sharepoint.site_collections'):
                logger.info(
                    'Starting the deindexing for site collection: %s' % collection)
                if ids["delete_keys"].get(collection):
                    ids = self.deindexing_sites(collection, ids)
                    ids = self.deindexing_lists(collection, ids)
                    ids = self.deindexing_items(collection, ids, "list_items")
                    ids = self.deindexing_items(collection, ids, "drive_items")
                else:
                    logger.info("No objects present to be deleted for the collection: %s" % collection)
            ids["delete_keys"] = {}
            with open(IDS_PATH, "w") as file:
                try:
                    json.dump(ids, file, indent=4)
                except ValueError as exception:
                    logger.exception(
                        "Error while updating the doc_id json file. Error: %s", exception
                    )
        except FileNotFoundError as exception:
            logger.warning(
                "[Fail] File doc_id.json is not present, none of the objects are indexed. Error: %s"
                % exception
            )