def _upgrade_docker(self, app, args): install = get_action('install')() action_args = install._build_namespace( _namespace=args, app=app, set_vars=self._get_configure_settings(self.old_app, filter_action=False), send_info=False, skip_checks=['must_not_be_installed']) if install.call_with_namespace(action_args): app_cache = Apps() for _app in app_cache.get_all_apps(): if _app.plugin_of == app.id and _app.is_installed(): _app = app_cache.find(_app.id, latest=True) if _app.docker: _old_app = self.old_app self._upgrade_docker(_app, args) self.old_app = _old_app remove = get_action('remove')() action_args = remove._build_namespace( _namespace=args, app=self.old_app, send_info=False, skip_checks=['must_not_be_depended_on']) remove._remove_app(self.old_app, action_args) if remove._unregister_component(self.old_app): update_packages() self._call_join_script( app, args ) # run again in case remove() called an installed unjoin script self.old_app = app
def test_install(self, app): unmet_apps = [] apps_cache = Apps() # RequiredApps for _app in apps_cache.get_all_apps(): if _app.id in app.required_apps: if not _app.is_installed(): unmet_apps.append({ 'id': _app.id, 'name': _app.name, 'in_domain': False }) # RequiredAppsInDomain domain = get_action('domain') apps = [ apps_cache.find(app_id) for app_id in app.required_apps_in_domain ] apps_info = domain.to_dict(apps) for _app in apps_info: if not _app: continue if not _app['is_installed_anywhere']: local_allowed = _app['id'] not in app.conflicted_apps unmet_apps.append({ 'id': _app['id'], 'name': _app['name'], 'in_domain': True, 'local_allowed': local_allowed }) unmet_apps = [ unmet_app for unmet_app in unmet_apps if unmet_app['id'] not in (_app.id for _app in self.other_apps(app)) ] if unmet_apps: return unmet_apps
def test_install(self, app): conflictedapps = set() apps_cache = Apps() # check ConflictedApps for _app in apps_cache.get_all_apps(): if not _app._allowed_on_local_server(): # cannot be installed, continue continue if _app.id in app.conflicted_apps or app.id in _app.conflicted_apps: if _app.is_installed(): conflictedapps.add(_app.id) elif _app in self.other_apps(app): conflictedapps.add(_app.id) # check port conflicts ports = [] for i in app.ports_exclusive: ports.append(i) for i in app.ports_redirection: ports.append(i.split(':', 1)[0]) for app_id, container_port, host_port in app_ports(): if app_id != app.id and str(host_port) in ports: conflictedapps.add(app_id) for _app in self.other_apps(app): other_ports = set() for i in _app.ports_exclusive: other_ports.add(i) for i in _app.ports_redirection: other_ports.add(i.split(':', 1)[0]) if other_ports.intersection(ports): conflictedapps.add(_app.id) if conflictedapps: conflictedapps = [ apps_cache.find(app_id) for app_id in conflictedapps ] return [{ 'id': _app.id, 'name': _app.name } for _app in conflictedapps if _app]