summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2019-02-10 15:13:56 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2019-02-10 15:13:56 (GMT)
commit77b85b1d7474e7c67137999542436de242b150b2 (patch)
treec6d37bac2ae497d74184edd10293e8679238c5f7
parent8707b0009f242399594fc7827d4f4925ddb39f62 (diff)
downloadmisc-fred-77b85b1d7474e7c67137999542436de242b150b2.zip
misc-fred-77b85b1d7474e7c67137999542436de242b150b2.tar.gz
misc-fred-77b85b1d7474e7c67137999542436de242b150b2.tar.bz2
munin: don't hardcode machine directory
-rwxr-xr-xmunin/publik_count13
1 files changed, 11 insertions, 2 deletions
diff --git a/munin/publik_count b/munin/publik_count
index 16d217a..9d93fce 100755
--- a/munin/publik_count
+++ b/munin/publik_count
@@ -5,8 +5,17 @@ import os
import psycopg2
import sys
+base_dir = None
+for dirname in os.listdir('/var/lib/machines/'):
+ if os.path.exists(os.path.join('/var/lib/machines/', dirname, 'var/lib/wcs')):
+ base_dir = os.path.join('/var/lib/machines/', dirname, 'var/lib/wcs')
+ break
+
if len(sys.argv) == 2 and sys.argv[1] == 'autoconf':
- print 'yes'
+ if base_dir:
+ print 'yes'
+ else:
+ print 'no'
sys.exit(0)
if len(sys.argv) == 2 and sys.argv[1] == 'config':
@@ -17,7 +26,7 @@ count.label Count
sys.exit(0)
total = 0
-base_dir = '/var/lib/machines/wcs.rbx.prod.entrouvert.org/var/lib/wcs/'
+
for tenant in os.listdir(base_dir):
if tenant in ('collectstatic', 'scripts', 'skeletons'):
continue