Commit 5d5a06c6 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Unify command line interface of neomigrate script.

- Remove connector option (not available in master, storage or admin)
- Use '-c' to specify the cluster name

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2129 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 85589f98
...@@ -31,15 +31,13 @@ parser.add_option('-v', '--verbose', action = 'store_true', ...@@ -31,15 +31,13 @@ parser.add_option('-v', '--verbose', action = 'store_true',
help = 'print verbose messages') help = 'print verbose messages')
parser.add_option('-s', '--source', help = 'the source database') parser.add_option('-s', '--source', help = 'the source database')
parser.add_option('-d', '--destination', help = 'the destination database') parser.add_option('-d', '--destination', help = 'the destination database')
parser.add_option('-c', '--connector', help = 'the NEO connector') parser.add_option('-c', '--cluster', help = 'the NEO cluster name')
parser.add_option('-n', '--name', help = 'the NEO cluster name')
# parse options # parse options
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
source = options.source or None source = options.source or None
destination = options.destination or None destination = options.destination or None
name = options.name or None cluster = options.cluster or None
connector = options.connector or 'SocketConnector'
# check options # check options
if source is None or destination is None: if source is None or destination is None:
...@@ -54,12 +52,11 @@ setupLog('neomigrate', None, options.verbose or False) ...@@ -54,12 +52,11 @@ setupLog('neomigrate', None, options.verbose or False)
from ZODB.FileStorage import FileStorage from ZODB.FileStorage import FileStorage
#from ZEO.ClientStorage import ClientStorage as ZEOStorage #from ZEO.ClientStorage import ClientStorage as ZEOStorage
from neo.client.Storage import Storage as NEOStorage from neo.client.Storage import Storage as NEOStorage
neo_args = { 'connector': connector, 'name': name, }
if os.path.exists(source): if os.path.exists(source):
src = FileStorage(file_name=source) src = FileStorage(file_name=source)
dst = NEOStorage(master_nodes=destination, **neo_args) dst = NEOStorage(master_nodes=destination, name=cluster)
else: else:
src = NEOStorage(master_nodes=source, **neo_args) src = NEOStorage(master_nodes=source, name=cluster)
dst = FileStorage(file_name=destination) dst = FileStorage(file_name=destination)
# do the job # do the job
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment