def run()

in treeherder/etl/files_bugzilla_map.py [0:0]


    def run(self):
        data_returned = self.fetch_data()
        if data_returned["exception"] is not None:
            logger.error(
                "error fetching file with map of source paths to Bugzilla products and components: url: %s ; %s",
                data_returned["url"],
                data_returned["exception"],
            )
            sys.exit()
        fields_data = data_returned["product_security_group_data"]["field"]["product"]["values"]
        groups_data = data_returned["product_security_group_data"]["group"]
        products = set()
        for field_data in fields_data:
            product_name = str(field_data["name"])
            security_group_id = str(field_data["security_group_id"])
            if security_group_id in groups_data:
                security_group_name = str(groups_data[security_group_id]["name"])
                products.add(product_name)
                try:
                    if len(product_name) > self.max_product_length:
                        logger.error(
                            "error inserting Bugzilla product and security group \"'%s' :: '%s'\" into db: product is too long (has %d characters, max is %d)",
                            product_name,
                            security_group_name,
                            len(product_name),
                            self.max_product_length,
                        )
                        continue
                    if len(security_group_name) > self.max_security_group_length:
                        logger.error(
                            "error inserting Bugzilla product and security group \"'%s' :: '%s'\" into db: security group is too long (has %d characters, max is %d)",
                            product_name,
                            security_group_name,
                            len(security_group_name),
                            self.max_security_group_length,
                        )
                        continue
                    BugzillaSecurityGroup.objects.get_or_create(
                        product=product_name,
                        security_group=security_group_name,
                    )
                except Exception as e:
                    logger.error(
                        "error inserting Bugzilla product and security group \"'%s' :: '%s'\" into db: %s",
                        product_name,
                        security_group_name,
                        e,
                    )
                    continue
        BugzillaSecurityGroup.objects.exclude(product__in=products).delete()