summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Admin/Minestruct.py
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2008-09-12 21:25:16 +0000
committerSol Jerome <solj@ices.utexas.edu>2008-09-12 21:25:16 +0000
commit01e56e153fd83c0b51760cf4ec04cc07e39bcc1b (patch)
tree8999bb657bb258d41d83244c0506c43956775512 /src/lib/Server/Admin/Minestruct.py
parentcd78f764f64ea2984c6382a20b7ffd7d44345995 (diff)
downloadbcfg2-01e56e153fd83c0b51760cf4ec04cc07e39bcc1b.tar.gz
bcfg2-01e56e153fd83c0b51760cf4ec04cc07e39bcc1b.tar.bz2
bcfg2-01e56e153fd83c0b51760cf4ec04cc07e39bcc1b.zip
Improve help messages for bcfg2-admin (and modes)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4910 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Admin/Minestruct.py')
-rw-r--r--src/lib/Server/Admin/Minestruct.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/lib/Server/Admin/Minestruct.py b/src/lib/Server/Admin/Minestruct.py
index 0bf7a5797..cc2a25533 100644
--- a/src/lib/Server/Admin/Minestruct.py
+++ b/src/lib/Server/Admin/Minestruct.py
@@ -4,22 +4,32 @@ import lxml.etree, sys, getopt
class Minestruct(Bcfg2.Server.Admin.StructureMode):
'''Pull extra entries out of statistics'''
- __shorthelp__ = 'bcfg2-admin minestruct [-f file-name] [-g groups] client'
- __longhelp__ = __shorthelp__ + '\n\tExtract extra entry lists from statistics'
+ __shorthelp__ = "Extract extra entry lists from statistics"
+ __longhelp__ = (__shorthelp__ +
+ "\n\nbcfg2-admin minestruct [-f filename] "
+ "[-g groups] client")
+ __usage__ = ("bcfg2-admin minestruct [options] <client>\n\n"
+ " %-25s%s\n"
+ " %-25s%s\n" %
+ ("-f <filename>",
+ "build a particular file",
+ "-g <groups>",
+ "only build config for groups"))
+
+ def __init__(self, configfile):
+ Bcfg2.Server.Admin.MetadataCore.__init__(self, configfile,
+ self.__usage__)
def __call__(self, args):
Bcfg2.Server.Admin.Mode.__call__(self, args)
if len(args) == 0:
- self.errExit("No hostname specified (see bcfg2-admin minestruct -h for help)")
+ self.errExit("No argument specified.\n"
+ "Please see bcfg2-admin minestruct help for usage.")
try:
(opts, args) = getopt.getopt(args, 'f:g:h')
except:
self.log.error(self.__shorthelp__)
raise SystemExit(1)
- if "-h" in args or not args:
- print "Usage:"
- print self.__shorthelp__
- raise SystemExit(1)
client = args[0]
output = sys.stdout
@@ -38,7 +48,8 @@ class Minestruct(Bcfg2.Server.Admin.StructureMode):
try:
extra = self.statistics.GetExtra(client)
except:
- self.log.error("Failed to find extra entry info for client %s" % client)
+ self.log.error("Failed to find extra entry info for client %s" %
+ client)
raise SystemExit(1)
root = lxml.etree.Element("Base")
self.log.info("Found %d extra entries" % (len(extra)))