Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
e0dd5f5e
Commit
e0dd5f5e
authored
Aug 02, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid duplication of code between zopectl and zdaemon.
parent
9c6ed42d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
57 deletions
+23
-57
src/Zope2/Startup/options.py
src/Zope2/Startup/options.py
+12
-25
src/Zope2/Startup/zopectl.py
src/Zope2/Startup/zopectl.py
+11
-32
No files found.
src/Zope2/Startup/options.py
View file @
e0dd5f5e
...
...
@@ -11,8 +11,16 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
The Zope run script.
"""Command-line processor for Zope."""
Usage: runzope [-C URL][-h] [options]
Options:
-C/--configure URL -- configuration file or URL
-X -- overwrite config file settings, e.g. -X "debug-mode=on"
-h/--help -- print this usage message and exit
"""
import
os
...
...
@@ -20,30 +28,9 @@ import zdaemon.zdoptions
class
ZopeOptions
(
zdaemon
.
zdoptions
.
ZDOptions
):
"""The Zope zdaemon runner script.
Usage: python Zope2/run.py [-C URL][-h] [zdrun-options] [action [arguments]]
Options:
-C/--configure URL -- configuration file or URL
-h/--help -- print usage message and exit
-b/--backoff-limit SECONDS -- set backoff limit to SECONDS (default 10)
-d/--daemon -- run as a proper daemon; fork a subprocess, close files etc.
-f/--forever -- run forever (by default, exit when backoff limit is exceeded)
-h/--help -- print this usage message and exit
-s/--socket-name SOCKET -- Unix socket name for client (default "zdsock")
-u/--user USER -- run as this user (or numeric uid)
-m/--umask UMASK -- use this umask for daemon subprocess (default is 022)
-x/--exit-codes LIST -- list of fatal exit codes (default "0,2")
-z/--directory DIRECTORY -- directory to chdir to when using -d (default off)
action [arguments] -- see below
Actions are commands like "start", "stop" and "status". If -i is
specified or no action is specified on the command line, a "shell"
interpreting actions typed interactively is started (unless the
configuration option default_to_interactive is set to false). Use the
action "help" to find out about available actions.
"""
# Provide help message, without indentation.
__doc__
=
__doc__
schemadir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
schemafile
=
"zopeschema.xml"
src/Zope2/Startup/zopectl.py
View file @
e0dd5f5e
...
...
@@ -32,8 +32,7 @@ action [arguments] -- see below
Actions are commands like "start", "stop" and "status". If -i is
specified or no action is specified on the command line, a "shell"
interpreting actions typed interactively is started (unless the
configuration option default_to_interactive is set to false). Use the
interpreting actions typed interactively is started. Use the
action "help" to find out about available actions.
"""
...
...
@@ -45,12 +44,10 @@ import signal
import
pkg_resources
import
zdaemon
import
Zope2.Startup
from
zdaemon.zdctl
import
ZDCmd
from
zdaemon.zdoptions
import
ZDOptions
from
zdaemon.zdctl
import
ZDCmd
,
ZDCtlOptions
from
ZConfig.components.logger.handlers
import
FileHandlerFactory
from
ZConfig.datatypes
import
existing_dirpath
from
Zope2.Startup.options
import
ZopeOptions
if
sys
.
version_info
>
(
3
,
0
):
basestring
=
str
...
...
@@ -76,25 +73,23 @@ def quote_command(command):
return
command
class
ZopeCtlOptions
(
Z
D
Options
):
class
ZopeCtlOptions
(
Z
opeOptions
,
ZDCtl
Options
):
# Zope controller options.
#
# After initialization, this should look very much like a
# zdaemon.zdctl.ZDCtlOptions instance. Many of the attributes are
# initialized from different sources, however.
# Provide help message, without indentation.
__doc__
=
__doc__
positional_args_allowed
=
1
schemadir
=
os
.
path
.
dirname
(
Zope2
.
Startup
.
__file__
)
schemafile
=
"zopeschema.xml"
uid
=
gid
=
None
positional_args_allowed
=
True
# this indicates that no explict program has been provided.
# this indicates that no explic
i
t program has been provided.
# the command line option can set this.
program
=
None
# this indicates that no explict socket name has been provided.
# this indicates that no explic
i
t socket name has been provided.
# the command line option can set this.
sockname
=
None
...
...
@@ -104,29 +99,13 @@ class ZopeCtlOptions(ZDOptions):
logsectionname
=
None
def
__init__
(
self
):
ZDOptions
.
__init__
(
self
)
self
.
add
(
"program"
,
"runner.program"
,
"p:"
,
"program="
,
handler
=
string_list
)
self
.
add
(
"backofflimit"
,
"runner.backoff_limit"
,
"b:"
,
"backoff-limit="
,
int
,
default
=
10
)
self
.
add
(
"daemon"
,
"runner.daemon"
,
"d"
,
"daemon"
,
flag
=
1
,
default
=
1
)
self
.
add
(
"forever"
,
"runner.forever"
,
"f"
,
"forever"
,
flag
=
1
,
default
=
0
)
self
.
add
(
"hang_around"
,
"runner.hang_around"
,
default
=
0
)
ZDCtlOptions
.
__init__
(
self
)
self
.
add
(
"interactive"
,
None
,
"i"
,
"interactive"
,
flag
=
1
)
self
.
add
(
"default_to_interactive"
,
"runner.default_to_interactive"
,
default
=
1
)
self
.
add
(
"logfile"
,
None
,
"l:"
,
"logfile="
)
self
.
add
(
"user"
,
"runner.user"
,
"u:"
,
"user="
)
self
.
add
(
"prompt"
,
"runner.prompt"
,
default
=
"zopectl>"
)
self
.
add
(
"umask"
,
"runner.umask"
,
"m:"
,
"umask="
)
self
.
add
(
"sockname"
,
"runner.socket_name"
,
"s:"
,
"socket-name="
,
existing_dirpath
,
default
=
None
)
self
.
add
(
"transcript"
,
"runner.transcript"
,
"t:"
,
"transcript="
,
default
=
"/dev/null"
)
def
realize
(
self
,
*
args
,
**
kw
):
Z
D
Options
.
realize
(
self
,
*
args
,
**
kw
)
Z
ope
Options
.
realize
(
self
,
*
args
,
**
kw
)
# Additional checking of user option; set uid and gid
if
self
.
user
is
not
None
:
import
pwd
...
...
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