Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def delete_application_on_fail(self, appname):
from cartoview.app_manager.installer import AppInstaller
AppInstaller(appname).uninstall(restart=True)
def delete_application_on_fail(self, appname):
from cartoview.app_manager.installer import AppInstaller
AppInstaller(appname).uninstall(restart=True)
try:
installed_app = App.objects.get(name=self.name)
if installed_app.version < self.version.version:
self.upgrade = True
else:
raise AppAlreadyInstalledException()
except App.DoesNotExist:
# NOTE:the following code handle if app downloaded and for
# some reason not added to the portal
self._rollback()
installed_apps = []
for name, version in list(self.version.dependencies.items()):
# use try except because AppInstaller.__init__ will handle
# upgrade if version not match
try:
app_installer = AppInstaller(
name, self.store.id, version, user=self.user)
installed_apps += app_installer.install(restart=False)
except AppAlreadyInstalledException as e:
logger.error(e.message)
self._download_app()
importlib.reload(pkg_resources)
self.check_then_finlize(restart, installed_apps)
return installed_apps
def uninstall_app(request, store_id, app_name):
response_data = {"success": False, "errors": []}
try:
installer = AppInstaller(app_name, store_id, user=request.user)
installer.uninstall(restart=False)
response_data["success"] = True
except Exception as ex:
logger.error(ex.message)
response_data["errors"].append(ex.message)
return HttpResponse(
json.dumps(response_data), content_type="application/json")
def delete_application_on_fail(self, appname):
from cartoview.app_manager.installer import AppInstaller
AppInstaller(appname).uninstall(restart=True)
var currentApp = appsHash[installedApp.name];
if(dependents.indexOf(currentApp) == -1 &&
currentApp.latest_version.dependencies[app.name]){
dependents.push(currentApp)
_getDependents(currentApp, appsHash, dependents)
}
});
:return:
"""
with lock:
uninstalled = False
installed_apps = App.objects.all()
for app in installed_apps:
app_installer = AppInstaller(
app.name, self.store.id, app.version, user=self.user)
dependencies = app_installer.version.dependencies \
if app_installer.version else {}
if self.name in dependencies.keys():
app_installer.uninstall(restart=False)
try:
installer = importlib.import_module('%s.installer' % self.name)
installer.uninstall()
except ImportError as e:
logger.error(e.message)
self.completely_remove()
uninstalled = True
if restart:
RestartHelper.restart_server()
return uninstalled