# HG changeset patch # User Sylvain Thénault # Date 1250241266 -7200 # Node ID 0477fff5f8979aec9015c35e814cbf1320229046 # Parent 107ba1c452279e897345215bf057dc35d885bf7f# Parent 107421e426de430cc6a32d990acf70bc7e2b8178 merge diff -r 107ba1c45227 -r 0477fff5f897 server/serverctl.py --- a/server/serverctl.py Fri Aug 14 11:14:10 2009 +0200 +++ b/server/serverctl.py Fri Aug 14 11:14:26 2009 +0200 @@ -481,7 +481,9 @@ def _remote_dump(host, appid, output, sudo=False): # XXX generate unique/portable file name - dmpcmd = 'cubicweb-ctl db-dump -o /tmp/%s.dump %s' % (appid, appid) + from datetime import date + filename = '%s-%s.tgz' % (appid, date.today().strftime('%Y-%m-%d')) + dmpcmd = 'cubicweb-ctl db-dump -o /tmp/%s %s' % (filename, appid) if sudo: dmpcmd = 'sudo %s' % (dmpcmd) dmpcmd = 'ssh -t %s "%s"' % (host, dmpcmd) @@ -489,18 +491,17 @@ if os.system(dmpcmd): raise ExecutionError('Error while dumping the database') if output is None: - from datetime import date - date = date.today().strftime('%Y-%m-%d') - output = '%s-%s.dump' % (appid, date) - cmd = 'scp %s:/tmp/%s.dump %s' % (host, appid, output) + output = filename + cmd = 'scp %s:/tmp/%s %s' % (host, filename, output) print cmd if os.system(cmd): - raise ExecutionError('Error while retrieving the dump') - rmcmd = 'ssh -t %s "rm -f /tmp/%s.dump"' % (host, appid) + raise ExecutionError('Error while retrieving the dump at /tmp/%s' % filename) + rmcmd = 'ssh -t %s "rm -f /tmp/%s"' % (host, filename) print rmcmd if os.system(rmcmd) and not ASK.confirm( - 'An error occured while deleting remote dump. Continue anyway?'): - raise ExecutionError('Error while deleting remote dump') + 'An error occured while deleting remote dump at /tmp/%s. ' + 'Continue anyway?' % filename): + raise ExecutionError('Error while deleting remote dump at /tmp/%s' % filename) def _local_dump(appid, output): config = ServerConfiguration.config_for(appid) @@ -669,9 +670,7 @@ import tempfile srcappid = pop_arg(args, 1, msg='No source instance specified !') destappid = pop_arg(args, msg='No destination instance specified !') - # XXX -system necessary to match file name modified on source restore. - # should not have to expect this. - _, output = tempfile.mkstemp('-system.sql') + output = tempfile.mkstemp(dir='/tmp/')[1] if ':' in srcappid: host, srcappid = srcappid.split(':') _remote_dump(host, srcappid, output, self.config.sudo) diff -r 107ba1c45227 -r 0477fff5f897 vregistry.py --- a/vregistry.py Fri Aug 14 11:14:10 2009 +0200 +++ b/vregistry.py Fri Aug 14 11:14:26 2009 +0200 @@ -314,7 +314,7 @@ except AttributeError: vname = obj.__class__.__name__ self.debug('registered appobject %s in registry %s with id %s', - vname, registryname, oid) + vname, registryname, oid or obj.id) self._loadedmods[obj.__module__]['%s.%s' % (obj.__module__, oid)] = obj def unregister(self, obj, registryname=None):