adminscripts: make info commands not use pidfile
authorMarko Kreen <markokr@gmail.com>
Wed, 20 Mar 2013 15:17:15 +0000 (17:17 +0200)
committerMarko Kreen <markokr@gmail.com>
Wed, 20 Mar 2013 15:17:15 +0000 (17:17 +0200)
otherwise they conflict with change operations.

python/londiste/setup.py
python/pgq/cascade/admin.py
python/skytools/adminscript.py

index 55ded040581e79d8218a10d185e82040874c5d3c..c764d49b20c7f88de1b99bc0ece745b2fd35c5ca 100644 (file)
@@ -17,6 +17,9 @@ class LondisteSetup(CascadeAdmin):
     initial_db_name = 'node_db'
     provider_location = None
 
+    commands_without_pidfile = CascadeAdmin.commands_without_pidfile + [
+            'tables', 'seqs', 'missing', 'show-handlers']
+
     def install_code(self, db):
         self.extra_objs = [
             skytools.DBSchema("londiste", sql_file = 'londiste.sql'),
index 61f1f448ec3d2654a0dca44d86af0d5916d9ecd8..8bf004e836f17c916118c780eeb1032735403c79 100644 (file)
@@ -79,6 +79,8 @@ class CascadeAdmin(skytools.AdminScript):
     local_node = None
     root_node_name = None
 
+    commands_without_pidfile = ['status', 'node-status', 'node-info']
+
     def __init__(self, svc_name, dbname, args, worker_setup = False):
         skytools.AdminScript.__init__(self, svc_name, args)
         self.initial_db_name = dbname
index 7ec16e754c22807b42f11f0cafd1b788a3959b07..8ef00f7da78764c6719b87ba913357ee49bef71d 100644 (file)
@@ -16,16 +16,22 @@ class AdminScript(skytools.DBScript):
     name.  If class method 'cmd_' + arg exists, it is called,
     otherwise error is given.
     """
+    commands_without_pidfile = {}
     def __init__(self, service_name, args):
         """AdminScript init."""
         skytools.DBScript.__init__(self, service_name, args)
-        if self.pidfile:
-            self.pidfile = self.pidfile + ".admin"
 
         if len(self.args) < 2:
             self.log.error("need command")
             sys.exit(1)
 
+        cmd = self.args[1]
+        if cmd in self.commands_without_pidfile:
+            self.pidfile = None
+
+        if self.pidfile:
+            self.pidfile = self.pidfile + ".admin"
+
     def work(self):
         """Non-looping work function, calls command function."""