summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Kreen2013-03-20 15:17:15 +0000
committerMarko Kreen2013-03-20 15:17:15 +0000
commit805ff65a57bea4a8cdc0bee677cc406581b5114f (patch)
treeb72b72ae867447fce7ca8951c05ea1f1838959d6
parent5a53f0c62c7ef557280ed781e9d90182a064d426 (diff)
adminscripts: make info commands not use pidfile
otherwise they conflict with change operations.
-rw-r--r--python/londiste/setup.py3
-rw-r--r--python/pgq/cascade/admin.py2
-rw-r--r--python/skytools/adminscript.py10
3 files changed, 13 insertions, 2 deletions
diff --git a/python/londiste/setup.py b/python/londiste/setup.py
index 55ded040..c764d49b 100644
--- a/python/londiste/setup.py
+++ b/python/londiste/setup.py
@@ -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'),
diff --git a/python/pgq/cascade/admin.py b/python/pgq/cascade/admin.py
index 61f1f448..8bf004e8 100644
--- a/python/pgq/cascade/admin.py
+++ b/python/pgq/cascade/admin.py
@@ -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
diff --git a/python/skytools/adminscript.py b/python/skytools/adminscript.py
index 7ec16e75..8ef00f7d 100644
--- a/python/skytools/adminscript.py
+++ b/python/skytools/adminscript.py
@@ -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."""