def _uninstall(package_name, remove_all, app_id, cli, app, skip_confirmation): """Uninstall the specified package. :param package_name: The package to uninstall :type package_name: str :param remove_all: Whether to remove all instances of the named package :type remove_all: boolean :param app_id: App ID of the package instance to uninstall :type app_id: str :param skip_confirmation: Skip confirmation for uninstall :type skip_confirmation: boolean :returns: Process status :rtype: int """ # Don't gate CLI uninstalls. # Don't gate uninstalls if the user wants to skip confirmation. if not cli and not skip_confirmation and not _confirm_uninstall( package_name, remove_all, app_id): return 0 package_manager = get_package_manager() package.uninstall(package_manager, package_name, remove_all, app_id, cli, app) return 0
def _uninstall(package_name, remove_all, app_id, cli, app, skip_confirmation, manager_id): """Uninstall the specified package. :param package_name: The package to uninstall :type package_name: str :param remove_all: Whether to remove all instances of the named package :type remove_all: boolean :param app_id: App ID of the package instance to uninstall :type app_id: str :param skip_confirmation: Skip confirmation for uninstall :type skip_confirmation: boolean :returns: Process status :rtype: int :param manager_id: defines the custom manager to forward this operation to :manager_id: str """ package_manager = get_package_manager() # Don't gate CLI uninstalls. # Don't gate uninstalls if the user wants to skip confirmation. if not cli and not skip_confirmation: installed = package.installed_packages( package_manager, None, package_name, cli_only=False) installed_pkg = next(iter(installed), None) if not installed_pkg or not installed_pkg.get('name'): msg = "Package '{}' is not installed.".format(package_name) emitter.publish(msg) return 1 if not _confirm_uninstall(installed_pkg, remove_all, app_id): return 0 package.uninstall( package_manager, package_name, remove_all, app_id, cli, app, manager_id) return 0
def _uninstall(package_name, remove_all, app_id, cli, app): """Uninstall the specified package. :param package_name: The package to uninstall :type package_name: str :param remove_all: Whether to remove all instances of the named package :type remove_all: boolean :param app_id: App ID of the package instance to uninstall :type app_id: str :returns: Process status :rtype: int """ err = package.uninstall(package_name, remove_all, app_id, cli, app) if err is not None: emitter.publish(err) return 1 return 0