[omd-commits] OMD Git: omd: omd: version allows a site to be specified

git version control git at mathias-kettner.de
Wed Jun 29 10:19:16 CEST 2011


Module:   omd
Branch:   master
Commit:   9c78930d25ba4f310df38da62332e39d4f24a0b0
URL:      http://omdistro.org/projects/omd/repository/revisions/9c78930d25ba4f310df38da62332e39d4f24a0b0

Author:   Mathias Kettner <mk at mathias-kettner.de>
Date:     Tue Jun 28 14:27:51 2011 +0200
Commiter: Mathias Kettner <mk at mathias-kettner.de>
Date:     Tue Jun 28 14:27:51 2011 +0200

omd: version allows a site to be specified

---

 packages/omd/omd   |   13 ++++++++++---
 packages/omd/omd.8 |    8 +++++---
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/packages/omd/omd b/packages/omd/omd
index 921064a..bda4bf3 100644
--- a/packages/omd/omd
+++ b/packages/omd/omd
@@ -1878,10 +1878,17 @@ def use_update_alternatives():
 
 
 def main_version(args, options={}):
+    if len(args) > 0:
+        site = args[0]
+        if not site_exists(site):
+            bail_out("No such site: %s" % site)
+        version = site_version(site)
+    else:
+        version = g_info["OMD_VERSION"]
     if "bare" in options:
-        sys.stdout.write(g_info["OMD_VERSION"] + "\n")
+        sys.stdout.write(version + "\n")
     else:
-        sys.stdout.write("OMD - Open Monitoring Distribution Version %s\n" % g_info["OMD_VERSION"])
+        sys.stdout.write("OMD - Open Monitoring Distribution Version %s\n" % version)
 
 
 def main_versions(args, options={}):
@@ -2364,7 +2371,7 @@ commands = [
     "Sets the default version of OMD which will be used by new sites",
     ""),
 
-  ( "version",   False, 0, 0, False, "",        main_version,
+  ( "version",   False, 0, 0, False, "[SITE]",        main_version,
     [("bare", "b", False)],
     "Show version of OMD",
     ""),
diff --git a/packages/omd/omd.8 b/packages/omd/omd.8
index 61eace0..6cc2467 100644
--- a/packages/omd/omd.8
+++ b/packages/omd/omd.8
@@ -47,11 +47,13 @@ sites within OMD - the open monitoring distribution.
 .B omd help
 Show short summary of available commands.
 .TP
-.B omd version [--bare, -b]
-Show the default version of you OMD installation. OMD supports
+.B omd version [--bare, -b] [SITE]
+Show the default version of your OMD installation. OMD supports
 multiple versions to be installed in parallel.
 The option \fB-b\fP or \fB--bare\fP reduces the output to the plain
-version number (for easier parsing in scripts).
+version number (for easier parsing in scripts). If you specify the name
+of a site then that site's version is being displayed instead of the
+default version.
 .TP
 .B omd versions [--bare, -b]
 Show a list of all installed versions of OMD. The option \fB-b\fP or \fB--bare\fP



More information about the omd-commits mailing list