diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2008-09-12 21:25:16 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2008-09-12 21:25:16 +0000 |
commit | 01e56e153fd83c0b51760cf4ec04cc07e39bcc1b (patch) | |
tree | 8999bb657bb258d41d83244c0506c43956775512 /src/lib/Server/Admin/Pull.py | |
parent | cd78f764f64ea2984c6382a20b7ffd7d44345995 (diff) | |
download | bcfg2-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/Pull.py')
-rw-r--r-- | src/lib/Server/Admin/Pull.py | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/lib/Server/Admin/Pull.py b/src/lib/Server/Admin/Pull.py index 6591cd604..6695ca715 100644 --- a/src/lib/Server/Admin/Pull.py +++ b/src/lib/Server/Admin/Pull.py @@ -1,14 +1,31 @@ - import binascii, difflib, getopt, lxml.etree, time, ConfigParser import Bcfg2.Server.Admin class Pull(Bcfg2.Server.Admin.MetadataCore): - '''Pull mode retrieves entries from clients and integrates the information into the repository''' - __shorthelp__ = 'bcfg2-admin pull [-v] [-f] [-I] <client> <entry type> <entry name>' - __longhelp__ = __shorthelp__ + '\n\tIntegrate configuration information from clients into the server repository' + ''' + Pull mode retrieves entries from clients and + integrates the information into the repository + ''' + __shorthelp__ = ("Integrate configuration information " + "from clients into the server repository") + __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin pull [-v] [-f][-I]" + "<client> <entry type> <entry name>") + __usage__ = ("bcfg2-admin pull [options] <client> <entry type> " + "<entry name>\n\n" + " %-25s%s\n" + " %-25s%s\n" + " %-25s%s\n" % + ("-v", + "be verbose", + "-f", + "force", + "-I", + "interactive")) allowed = ['Metadata', 'BB', "DBStats", "Statistics", "Cfg", "SSHbase"] + def __init__(self, configfile): - Bcfg2.Server.Admin.MetadataCore.__init__(self, configfile) + Bcfg2.Server.Admin.MetadataCore.__init__(self, configfile, + self.__usage__) self.stats = self.bcore.stats self.log = False self.mode = 'interactive' @@ -19,7 +36,7 @@ class Pull(Bcfg2.Server.Admin.MetadataCore): opts, gargs = getopt.getopt(args, 'vfI') except: print self.__shorthelp__ - raise SystemExit(0) + raise SystemExit(1) for opt in opts: if opt[0] == '-v': self.log = True @@ -37,7 +54,7 @@ class Pull(Bcfg2.Server.Admin.MetadataCore): self.stats.GetCurrentEntry(client, etype, ename) except Bcfg2.Server.Plugin.PluginExecutionError: print "Statistics plugin failure; could not fetch current state" - raise SystemExit, 1 + raise SystemExit(1) data = {'owner':owner, 'group':group, 'perms':perms, 'text':contents} for k, v in data.iteritems(): @@ -54,7 +71,8 @@ class Pull(Bcfg2.Server.Admin.MetadataCore): if choices[0].all: print " => global entry" elif choices[0].group: - print " => group entry: %s (prio %d)" % (choices[0].group, choices[0].prio) + print (" => group entry: %s (prio %d)" % + (choices[0].group, choices[0].prio)) else: print " => host entry: %s" % (choices[0].hostname) if raw_input("Use this entry? [yN]: ") in ['y', 'Y']: |