server/serverctl.py
branch3.5
changeset 3119 819aea456251
parent 3115 29262ba01464
child 3148 81d373245ce9
child 3184 613064b49331
equal deleted inserted replaced
3111:7b405bb305ab 3119:819aea456251
   310         indexer = get_indexer(driver)
   310         indexer = get_indexer(driver)
   311         indexer.init_extensions(cursor)
   311         indexer.init_extensions(cursor)
   312         # postgres specific stuff
   312         # postgres specific stuff
   313         if driver == 'postgres':
   313         if driver == 'postgres':
   314             # install plpythonu/plpgsql language if not installed by the cube
   314             # install plpythonu/plpgsql language if not installed by the cube
   315             for extlang in ('plpythonu', 'plpgsql'):
   315             langs = ('plpgsql',) if sys.platform == 'win32' else ('plpythonu', 'plpgsql') 
       
   316             for extlang in langs:
   316                 helper.create_language(cursor, extlang)
   317                 helper.create_language(cursor, extlang)
   317         cursor.close()
   318         cursor.close()
   318         cnx.commit()
   319         cnx.commit()
   319         print '-> database for instance %s created and necessary extensions installed.' % appid
   320         print '-> database for instance %s created and necessary extensions installed.' % appid
   320         print
   321         print
   674 
   675 
   675     def run(self, args):
   676     def run(self, args):
   676         import tempfile
   677         import tempfile
   677         srcappid = pop_arg(args, 1, msg='No source instance specified !')
   678         srcappid = pop_arg(args, 1, msg='No source instance specified !')
   678         destappid = pop_arg(args, msg='No destination instance specified !')
   679         destappid = pop_arg(args, msg='No destination instance specified !')
   679         output = tempfile.mkstemp(dir='/tmp/')[1]
   680         output = tempfile.mkstemp()[1]
   680         if ':' in srcappid:
   681         if ':' in srcappid:
   681             host, srcappid = srcappid.split(':')
   682             host, srcappid = srcappid.split(':')
   682             _remote_dump(host, srcappid, output, self.config.sudo)
   683             _remote_dump(host, srcappid, output, self.config.sudo)
   683         else:
   684         else:
   684             _local_dump(srcappid, output)
   685             _local_dump(srcappid, output)