def deploy()

in src/ab/utils/sae_util.py [0:0]


def deploy(args: dict) -> bool:
    logger.info("Start deploy, Please wait...")
    image_url = get_image_url(args)
    if image_url is None:
        return False
    else:
        logger.info("The image is: [{}]".format(image_url))

    sl_namespace = get_sl_namespace()

    sl_namespace_info = get_sl_namespace_info(sl_namespace, False)

    if sl_namespace_info is None and sl_namespace != "Default":
        return False
    app_name = get_app_name(args)
    app = get_application(get_app_name(args), sl_namespace_info)
    request = SaeRequest()
    if app is not None:
        if args.get(" -f ") == "true":
            delete_app = "yes"
        else:
            delete_app = input(
                "The application [{}] already exists. Do you want to delete the original application and "
                "deploy the new application? (yes/no)".format(app_name))
        if str(delete_app).strip().lower() == "yes" or str(delete_app).strip().lower() == "y":
            logger.info("Deleting the application, Please wait...")

            result, change_id = delete_application(request, app)
            if not result:
                logger.error("Failed to delete the application.")
                return False
            else:
                from ab.utils import oss_util
                oss_util.rm_object(ab.get_value("oss_bucket"), get_oss_log_path(app_name) + "/")
                change_status = get_status(change_id)
                if change_status == 2:
                    logger.info("Deleting the application succeeded.")
                    logger.info("Creating an new application, Please wait...")
                else:
                    logger.error("Failed to delete the application.")
                    return False
        else:
            logger.warning("You have terminated the deployment operation")
            return False
    else:
        logger.info("Creating the application, Please wait...")

    app_id, change_id = create_application(request, get_app_params(args, image_url, sl_namespace_info))
    if app_id is None or change_id is None:
        return False
    change_status = get_status(change_id)
    if change_status is None or change_status != 2:
        logger.error("Failed to create an application.")
        return False
    else:
        logger.info("Creating an application succeeded.")

    logger.info("The SLB binding starts,Please wait...")
    change_id, node_port = bind_slb(app_id, ab.get_value("slb"), ab.get_value("port"))
    if change_id is None:
        logger.error("Failed to bind SLB.")
        return False
    change_status = get_status(change_id)
    if change_status == 2:
        logger.info("The SLB binding succeeded, Access path: [http://{}:{}].".format(ab.get_value("slb_ip"), node_port))
        return True
    logger.error("Failed to bind SLB.")
    return False