[Zodb-checkins] CVS: ZODB3/zdaemon - zdctl.py:1.28

Guido van Rossum guido@python.org
Thu, 23 Jan 2003 16:20:30 -0500


Update of /cvs-repository/ZODB3/zdaemon
In directory cvs.zope.org:/tmp/cvs-serv27001

Modified Files:
	zdctl.py 
Log Message:
Added "reload" command.

Handled some long lines.


=== ZODB3/zdaemon/zdctl.py 1.27 => 1.28 ===
--- ZODB3/zdaemon/zdctl.py:1.27	Thu Jan 23 15:41:51 2003
+++ ZODB3/zdaemon/zdctl.py	Thu Jan 23 16:20:28 2003
@@ -201,8 +201,8 @@
             args += self._get_override("-f", "forever", flag=1)
             args += self._get_override("-s", "sockname")
             args += self._get_override("-u", "user")
-            args += self._get_override("-x", "exitcodes",
-                                       ",".join(map(str, self.options.exitcodes)))
+            args += self._get_override(
+                "-x", "exitcodes", ",".join(map(str, self.options.exitcodes)))
             args += self._get_override("-z", "directory")
             args.extend(self.options.program)
             if self.options.daemon:
@@ -415,6 +415,33 @@
         print "                   Without a command, start an interactive sh."
         print "An alias for this command is ! [command]"
 
+    def do_reload(self, arg):
+        if arg:
+            args = arg.split()
+            if self.options.configfile:
+                args = ["-C", self.options.configfile] + args
+        else:
+            args = None
+        options = ZDCtlOptions()
+        options.positional_args_allowed = 0
+        try:
+            options.realize(args)
+        except SystemExit:
+            print "Configuration not reloaded"
+        else:
+            self.options = options
+            if self.options.configfile:
+                print "Configuration reloaded from", self.options.configfile
+            else:
+                print "Configuration reloaded without a config file"
+
+    def help_reload(self):
+        print "reload [options] -- Reload the configuration."
+        print "    Without options, this reparses the command line."
+        print "    With options, this substitutes 'options' for the"
+        print "    command line, except that if no -C option is given,"
+        print "    the last configuration file is used."
+
     def do_quit(self, arg):
         self.get_status()
         if not self.zd_up:
@@ -429,8 +456,9 @@
 
     def help_quit(self):
         print "quit -- Exit the zdctl shell."
-        print ("        If the daemon process is not running, "
-               "stop the daemon manager.")
+        print "        If the daemon process is not running,"
+        print "        stop the daemon manager."
+
 
 def main(args=None):
     options = ZDCtlOptions()