[REV] Revert code for the hostname and the dump

bzr revid: stephane@tinyerp.com-20090129133946-l05fi1j8rou9tqyn
This commit is contained in:
Stephane Wirtel 2009-01-29 14:39:46 +01:00
parent f3bd6582fc
commit 90dea28166
2 changed files with 5 additions and 5 deletions

View File

@ -173,7 +173,7 @@ class db(netsvc.Service):
cmd = ['pg_dump', '--format=c']
if tools.config['db_user']:
cmd.append('--username=' + tools.config['db_user'])
if tools.config['db_host'] and tools.config['db_host'] not in ('127.0.0.1', 'localhost'):
if tools.config['db_host']:
cmd.append('--host=' + tools.config['db_host'])
if tools.config['db_port']:
cmd.append('--port=' + tools.config['db_port'])
@ -184,9 +184,11 @@ class db(netsvc.Service):
data = stdout.read()
res = stdout.close()
if res:
logger.notifyChannel("web-services", netsvc.LOG_ERROR, 'DUMP DB: %s failed\n%s' % (db_name, data))
logger.notifyChannel("web-services", netsvc.LOG_ERROR,
'DUMP DB: %s failed\n%s' % (db_name, data))
raise Exception, "Couldn't dump database"
logger.notifyChannel("web-services", netsvc.LOG_INFO, 'DUMP DB: %s' % (db_name))
logger.notifyChannel("web-services", netsvc.LOG_INFO,
'DUMP DB: %s' % (db_name))
return base64.encodestring(data)
def restore(self, password, db_name, data):

View File

@ -204,8 +204,6 @@ class PoolManager(object):
cls._dsn = ''
for p in ('host', 'port', 'user', 'password'):
cfg = tools.config['db_' + p]
if p == 'host' and cfg in ('127.0.0.1', 'localhost'):
continue
if cfg:
cls._dsn += '%s=%s ' % (p, cfg)
return '%s dbname=%s' % (cls._dsn, db_name)