# HG changeset patch # User Aurelien Campeas # Date 1404916388 -7200 # Node ID 3a39f145d5308264ca636d2ba483db5ef3d28578 # Parent 744e57d74f6df3870e9f08ee80f8d40f5b844af6 [cwctl] remove networked remote shell This was a dbapi leftover. Related to #3933480. diff -r 744e57d74f6d -r 3a39f145d530 cubicweb/cwctl.py --- a/cubicweb/cwctl.py Tue Mar 15 14:30:21 2016 +0100 +++ b/cubicweb/cwctl.py Wed Jul 09 16:33:08 2014 +0200 @@ -46,7 +46,7 @@ from logilab.common.deprecation import deprecated from cubicweb import ConfigurationError, ExecutionError, BadCommandUsage -from cubicweb.utils import support_args +from cubicweb.utils import admincnx from cubicweb.cwconfig import CubicWebConfiguration as cwcfg, CWDEV, CONFIGURATIONS from cubicweb.toolsutils import Command, rm, create_dir, underline_title from cubicweb.__pkginfo__ import version @@ -868,7 +868,7 @@ }), ) - def _handle_inmemory(self, appid): + def _get_mih(self, appid): """ returns migration context handler & shutdown function """ config = cwcfg.config_for(appid) if self.config.ext_sources: @@ -880,34 +880,10 @@ sources = ('all',) config.set_sources_mode(sources) config.repairing = self.config.force + cnx = admincnx(appid) mih = config.migration_handler() return mih, lambda: mih.shutdown() - def _handle_networked(self, appuri): - """ returns migration context handler & shutdown function """ - from cubicweb import AuthenticationError - from cubicweb.repoapi import connect, get_repository - from cubicweb.server.utils import manager_userpasswd - from cubicweb.server.migractions import ServerMigrationHelper - while True: - try: - login, pwd = manager_userpasswd(msg=None) - repo = get_repository(appuri) - cnx = connect(repo, login=login, password=pwd, mulcnx=False) - except AuthenticationError as ex: - print(ex) - except (KeyboardInterrupt, EOFError): - print() - sys.exit(0) - else: - break - cnx.load_appobjects() - repo = cnx._repo - mih = ServerMigrationHelper(None, repo=repo, cnx=cnx, verbosity=0, - # hack so it don't try to load fs schema - schema=1) - return mih, lambda: cnx.close() - def run(self, args): appuri = args.pop(0) if self.config.repo_uri: @@ -916,12 +892,7 @@ if urlparse(self.config.repo_uri).scheme == 'inmemory': appuri = '%s/%s' % (self.config.repo_uri.rstrip('/'), appuri) - from cubicweb.utils import parse_repo_uri - protocol, hostport, appid = parse_repo_uri(appuri) - if protocol == 'inmemory': - mih, shutdown_callback = self._handle_inmemory(appid) - else: - mih, shutdown_callback = self._handle_networked(appuri) + mih, shutdown_callback = self._get_mih(appuri) try: with mih.cnx: with mih.cnx.security_enabled(False, False):