Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefane Fermigier
neo
Commits
32b2d173
Commit
32b2d173
authored
Sep 24, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move common command-line options to neo.lib.config
parent
727899e2
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
43 deletions
+33
-43
neo/lib/config.py
neo/lib/config.py
+20
-0
neo/scripts/neoadmin.py
neo/scripts/neoadmin.py
+2
-11
neo/scripts/neoctl.py
neo/scripts/neoctl.py
+2
-3
neo/scripts/neomaster.py
neo/scripts/neomaster.py
+2
-11
neo/scripts/neomigrate.py
neo/scripts/neomigrate.py
+5
-7
neo/scripts/neostorage.py
neo/scripts/neostorage.py
+2
-11
No files found.
neo/lib/config.py
View file @
32b2d173
...
...
@@ -14,10 +14,30 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
optparse
import
OptionParser
from
ConfigParser
import
SafeConfigParser
,
NoOptionError
from
.
import
util
from
.util
import
parseNodeAddress
def
getOptionParser
():
parser
=
OptionParser
()
parser
.
add_option
(
'-l'
,
'--logfile'
,
help
=
'log debugging information to specified SQLite DB'
)
return
parser
def
getServerOptionParser
():
parser
=
getOptionParser
()
parser
.
add_option
(
'-f'
,
'--file'
,
help
=
'specify a configuration file'
)
parser
.
add_option
(
'-s'
,
'--section'
,
help
=
'specify a configuration section'
)
parser
.
add_option
(
'-c'
,
'--cluster'
,
help
=
'the cluster name'
)
parser
.
add_option
(
'-m'
,
'--masters'
,
help
=
'master node list'
)
parser
.
add_option
(
'-b'
,
'--bind'
,
help
=
'the local address to bind to'
)
parser
.
add_option
(
'-D'
,
'--dynamic-master-list'
,
help
=
'path of the file containing dynamic master node list'
)
return
parser
class
ConfigurationManager
(
object
):
"""
Configuration manager that load options from a configuration file and
...
...
neo/scripts/neoadmin.py
View file @
32b2d173
...
...
@@ -17,21 +17,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
optparse
import
OptionParser
from
neo.lib
import
logging
from
neo.lib.config
import
ConfigurationManager
from
neo.lib.config
import
getServerOptionParser
,
ConfigurationManager
parser
=
OptionParser
()
parser
=
getServer
OptionParser
()
parser
.
add_option
(
'-u'
,
'--uuid'
,
help
=
'specify an UUID to use for this '
\
'process'
)
parser
.
add_option
(
'-f'
,
'--file'
,
help
=
'specify a configuration file'
)
parser
.
add_option
(
'-s'
,
'--section'
,
help
=
'specify a configuration section'
)
parser
.
add_option
(
'-l'
,
'--logfile'
,
help
=
'specify a logging file'
)
parser
.
add_option
(
'-c'
,
'--cluster'
,
help
=
'the cluster name'
)
parser
.
add_option
(
'-m'
,
'--masters'
,
help
=
'master node list'
)
parser
.
add_option
(
'-b'
,
'--bind'
,
help
=
'the local address to bind to'
)
parser
.
add_option
(
'-D'
,
'--dynamic-master-list'
,
help
=
'path of the file '
'containing dynamic master node list'
)
defaults
=
dict
(
bind
=
'127.0.0.1:9999'
,
...
...
neo/scripts/neoctl.py
View file @
32b2d173
...
...
@@ -17,15 +17,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
optparse
import
OptionParser
from
neo.lib
import
logging
from
neo.lib.config
import
getOptionParser
from
neo.lib.util
import
parseNodeAddress
parser
=
OptionParser
()
parser
=
get
OptionParser
()
parser
.
add_option
(
'-a'
,
'--address'
,
help
=
'specify the address (ip:port) '
\
'of an admin node'
,
default
=
'127.0.0.1:9999'
)
parser
.
add_option
(
'--handler'
,
help
=
'specify the connection handler'
)
parser
.
add_option
(
'-l'
,
'--logfile'
,
help
=
'specify a logging file'
)
def
main
(
args
=
None
):
(
options
,
args
)
=
parser
.
parse_args
(
args
=
args
)
...
...
neo/scripts/neomaster.py
View file @
32b2d173
...
...
@@ -17,22 +17,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
optparse
import
OptionParser
from
neo.lib
import
logging
from
neo.lib.config
import
ConfigurationManager
from
neo.lib.config
import
getServerOptionParser
,
ConfigurationManager
parser
=
OptionParser
()
parser
.
add_option
(
'-f'
,
'--file'
,
help
=
'specify a configuration file'
)
parser
.
add_option
(
'-s'
,
'--section'
,
help
=
'specify a configuration section'
)
parser
=
getServerOptionParser
()
parser
.
add_option
(
'-u'
,
'--uuid'
,
help
=
'the node UUID (testing purpose)'
)
parser
.
add_option
(
'-b'
,
'--bind'
,
help
=
'the local address to bind to'
)
parser
.
add_option
(
'-c'
,
'--cluster'
,
help
=
'the cluster name'
)
parser
.
add_option
(
'-m'
,
'--masters'
,
help
=
'master node list'
)
parser
.
add_option
(
'-r'
,
'--replicas'
,
help
=
'replicas number'
)
parser
.
add_option
(
'-p'
,
'--partitions'
,
help
=
'partitions number'
)
parser
.
add_option
(
'-l'
,
'--logfile'
,
help
=
'specify a logging file'
)
parser
.
add_option
(
'-D'
,
'--dynamic-master-list'
,
help
=
'path of the file '
'containing dynamic master node list'
)
parser
.
add_option
(
'-A'
,
'--autostart'
,
help
=
'minimum number of pending storage nodes to automatically start'
' new cluster (to avoid unwanted recreation of the cluster,'
...
...
neo/scripts/neomigrate.py
View file @
32b2d173
...
...
@@ -17,17 +17,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
optparse
import
OptionParser
from
neo.lib.config
import
get
OptionParser
import
time
import
os
# register options
parser
=
OptionParser
()
parser
.
add_option
(
'-l'
,
'--logfile'
,
help
=
'log debugging information to specified SQLite DB'
)
parser
.
add_option
(
'-s'
,
'--source'
,
help
=
'the source database'
)
parser
.
add_option
(
'-d'
,
'--destination'
,
help
=
'the destination database'
)
parser
.
add_option
(
'-c'
,
'--cluster'
,
help
=
'the NEO cluster name'
)
parser
=
getOptionParser
()
parser
.
add_option
(
'-s'
,
'--source'
,
help
=
'the source database'
)
parser
.
add_option
(
'-d'
,
'--destination'
,
help
=
'the destination database'
)
parser
.
add_option
(
'-c'
,
'--cluster'
,
help
=
'the NEO cluster name'
)
def
main
(
args
=
None
):
# parse options
...
...
neo/scripts/neostorage.py
View file @
32b2d173
...
...
@@ -17,28 +17,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
optparse
import
OptionParser
from
neo.lib
import
logging
from
neo.lib.config
import
ConfigurationManager
from
neo.lib.config
import
getServerOptionParser
,
ConfigurationManager
parser
=
OptionParser
()
parser
=
getServer
OptionParser
()
parser
.
add_option
(
'-u'
,
'--uuid'
,
help
=
'specify an UUID to use for this '
\
'process. Previously assigned UUID takes precedence (ie '
\
'you should always use -R with this switch)'
)
parser
.
add_option
(
'-f'
,
'--file'
,
help
=
'specify a configuration file'
)
parser
.
add_option
(
'-s'
,
'--section'
,
help
=
'specify a configuration section'
)
parser
.
add_option
(
'-l'
,
'--logfile'
,
help
=
'specify a logging file'
)
parser
.
add_option
(
'-R'
,
'--reset'
,
action
=
'store_true'
,
help
=
'remove an existing database if any'
)
parser
.
add_option
(
'-b'
,
'--bind'
,
help
=
'the local address to bind to'
)
parser
.
add_option
(
'-c'
,
'--cluster'
,
help
=
'the cluster name'
)
parser
.
add_option
(
'-m'
,
'--masters'
,
help
=
'master node list'
)
parser
.
add_option
(
'-a'
,
'--adapter'
,
help
=
'database adapter to use'
)
parser
.
add_option
(
'-d'
,
'--database'
,
help
=
'database connections string'
)
parser
.
add_option
(
'-e'
,
'--engine'
,
help
=
'database engine'
)
parser
.
add_option
(
'-D'
,
'--dynamic-master-list'
,
help
=
'path of the file '
'containing dynamic master node list'
)
parser
.
add_option
(
'-w'
,
'--wait'
,
help
=
'seconds to wait for backend to be '
'available, before erroring-out (-1 = infinite)'
,
type
=
'float'
,
default
=
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment