From 9aa7737a2840b5ce6688731f84ed49d558e3dc30 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 14 Dec 2010 00:41:43 +0100 Subject: Plugins: Added missing plugins (cherry picked from commit 57a1e3b50e01c0c81047bea36ed862a11330d7e5) --- src/lib/Server/Admin/Init.py | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py index c6d1f9e3d..1f00ce2a0 100644 --- a/src/lib/Server/Admin/Init.py +++ b/src/lib/Server/Admin/Init.py @@ -76,11 +76,33 @@ os_list = [ ] # Complete list of plugins -plugin_list = ['Account', 'Base', 'Bundler', 'Cfg', - 'Decisions', 'Deps', 'Metadata', 'Packages', - 'Pkgmgr', 'Probes', 'Properties', 'Rules', - 'Snapshots', 'SSHbase', 'Statistics', 'Svcmgr', - 'TCheetah', 'TGenshi'] +plugin_list = [ + 'Account', + 'Base', + 'Bundler', + 'Bzr', + 'Cfg', + 'Decisions', + 'Deps', + 'Git', + 'Guppy', + 'Hg', + 'Metadata', + 'NagiosGen', + 'Ohai', + 'Packages', + 'Pkgmgr', + 'Probes', + 'Properties', + 'Rules', + 'Snapshots', + 'SSHbase', + 'SSLCA', + 'Statistics', + 'Svcmgr', + 'TCheetah', + 'TGenshi' + ] # Default list of plugins to use default_plugins = ['SSHbase', 'Cfg', 'Pkgmgr', 'Rules', -- cgit v1.2.3-1-g7c22 From bc1ee763eef9caa66b1c4ab846c6884515dc93c4 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 14 Dec 2010 00:54:57 +0100 Subject: Plugins: Ordered defaults plugins (cherry picked from commit 99bbe3f9d130bf9939489c4cd959373b1f3ce43f) --- src/lib/Server/Admin/Init.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py index 1f00ce2a0..3a461681b 100644 --- a/src/lib/Server/Admin/Init.py +++ b/src/lib/Server/Admin/Init.py @@ -105,8 +105,15 @@ plugin_list = [ ] # Default list of plugins to use -default_plugins = ['SSHbase', 'Cfg', 'Pkgmgr', 'Rules', - 'Metadata', 'Base', 'Bundler'] +default_plugins = [ + 'Base', + 'Bundler' + 'Cfg', + 'Metadata', + 'Pkgmgr', + 'Rules', + 'SSHbase' + ] def gen_password(length): """Generates a random alphanumeric password with length characters.""" @@ -125,7 +132,7 @@ def create_key(hostname, keypath, certpath): os.chmod(keypath, 0600) def create_conf(confpath, confdata): - # don't overwrite existing bcfg2.conf file + # Don't overwrite existing bcfg2.conf file if os.path.exists(confpath): result = raw_input("\nWarning: %s already exists. " "Overwrite? [y/N]: " % confpath) @@ -253,7 +260,7 @@ class Init(Bcfg2.Server.Admin.Mode): plugin = plugin.strip() if not plugin in plugin_list: plugins_are_valid = False - print "ERROR: plugin %s not recognized" % plugin + print "ERROR: Plugin %s not recognized" % plugin if plugins_are_valid: break -- cgit v1.2.3-1-g7c22 From fb726eeb63c669a6b96dfeb4876e8c6bb6dbf28f Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 18 Dec 2010 18:44:52 +0100 Subject: Merge (cherry picked from commit 841dbffb1802716cfb820759dab1120e4f7857d4) --- src/lib/Server/Admin/Bundle.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Bundle.py b/src/lib/Server/Admin/Bundle.py index 893fde489..efbe2b486 100644 --- a/src/lib/Server/Admin/Bundle.py +++ b/src/lib/Server/Admin/Bundle.py @@ -10,9 +10,9 @@ class Bundle(Bcfg2.Server.Admin.MetadataCore): __shorthelp__ = "Create or delete bundle entries" __longhelp__ = (__shorthelp__ + #"\n\nbcfg2-admin bundle add " #"\n\nbcfg2-admin bundle del " - "\n\nbcfg2-admin bundle list-xml" - "\n\nbcfg2-admin bundle list-genshi" - "\n\nbcfg2-admin bundle show") + "\nbcfg2-admin bundle list-xml" + "\nbcfg2-admin bundle list-genshi" + "\nbcfg2-admin bundle show\n") __usage__ = ("bcfg2-admin bundle [options] [add|del] [group]") def __init__(self, configfile): @@ -23,7 +23,7 @@ class Bundle(Bcfg2.Server.Admin.MetadataCore): Bcfg2.Server.Admin.MetadataCore.__call__(self, args) reg='((?:[a-z][a-z\\.\\d\\-]+)\\.(?:[a-z][a-z\\-]+))(?![\\w\\.])' - #Get all bundles out of the Bundle/ directory + # Get all bundles out of the Bundle/ directory opts = {'repo': Bcfg2.Options.SERVER_REPOSITORY} setup = Bcfg2.Options.OptionParser(opts) setup.parse(sys.argv[1:]) -- cgit v1.2.3-1-g7c22 From 13ed2fadfafebfacec0f9284bdfbe5c852600e43 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sun, 19 Dec 2010 23:02:21 +0100 Subject: Minor changes acc. PEP8 (cherry picked from commit e36006a033f9610382a4a0f233b14df246acd851) --- src/lib/Options.py | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Options.py b/src/lib/Options.py index 1dcad6427..4041ccf78 100644 --- a/src/lib/Options.py +++ b/src/lib/Options.py @@ -93,7 +93,7 @@ class Option(object): def parse(self, opts, rawopts): if self.cmd and opts: - # processing getopted data + # Processing getopted data optinfo = [opt[1] for opt in opts if opt[0] == self.cmd] if optinfo: if optinfo[0]: @@ -105,7 +105,7 @@ class Option(object): data = rawopts[rawopts.index(self.cmd) + 1] self.value = self.get_cooked_value(data) return - # no command line option found + # No command line option found if self.env and self.env in os.environ: self.value = self.get_cooked_value(os.environ[self.env]) return @@ -115,7 +115,7 @@ class Option(object): return except: pass - # default value not cooked + # Default value not cooked self.value = self.default class OptionSet(dict): @@ -141,7 +141,7 @@ class OptionSet(dict): raise SystemExit(code) def parse(self, argv, do_getopt=True): - '''Parse options''' + '''Parse options from command line.''' if do_getopt: try: opts, args = getopt.getopt(argv, self.buildGetopt(), @@ -171,7 +171,7 @@ def colon_split(c_string): return c_string.split(':') return [] -#General options +# General options CFILE = Option('Specify configuration file', DEFAULT_CONFIG_LOCATION, cmd='-C', odesc='') LOCKFILE = Option('Specify lockfile', @@ -187,7 +187,7 @@ INSTALL_PREFIX = Option('Installation location', cf=('server', 'prefix'), default=DEFAULT_INSTALL_PREFIX, odesc='') SENDMAIL_PATH = Option('Path to sendmail', cf=('reports', 'sendmailpath'), default='/usr/lib/sendmail') -INTERACTIVE = Option('prompt the user for each change', default=False, +INTERACTIVE = Option('Prompt the user for each change', default=False, cmd='-I', ) ENCODING = Option('Encoding of cfg files', default=sys.getdefaultencoding(), cmd='-E', odesc='', @@ -201,8 +201,8 @@ PARANOID_MAX_COPIES = Option('Specify the number of paranoid copies you want', OMIT_LOCK_CHECK = Option('Omit lock check', default=False, cmd='-O') CORE_PROFILE = Option('profile', default=False, cmd='-p', ) - -#Metadata options + +# Metadata options MDATA_OWNER = Option('Default Path owner', default='root', cf=('mdata', 'owner'), odesc='owner permissions') @@ -219,7 +219,7 @@ MDATA_PARANOID = Option('Default Path paranoid setting', 'false', cf=('mdata', 'paranoid'), odesc='Path paranoid setting') -#Server options +# Server options SERVER_REPOSITORY = Option('Server repository path', '/var/lib/bcfg2', cf=('server', 'repository'), cmd='-Q', odesc='') @@ -255,7 +255,7 @@ SERVER_PASSWORD = Option('Communication Password', cmd='-x', odesc='', cf=('communication', 'password'), default=False) SERVER_PROTOCOL = Option('Server Protocol', cf=('communication', 'procotol'), default='xmlrpc/ssl') -#Client options +# Client options CLIENT_KEY = Option('Path to SSL key', cf=('communication', 'key'), default=None, cmd="--ssl-key", odesc='', long_arg=True) @@ -265,44 +265,44 @@ CLIENT_CERT = Option('Path to SSL certificate', default=None, cmd="--ssl-cert", CLIENT_CA = Option('Path to SSL CA Cert', default=None, cmd="--ca-cert", cf=('communication', 'ca'), odesc='', long_arg=True) -CLIENT_SCNS = Option('list of server commonNames', default=None, cmd="--ssl-cns", +CLIENT_SCNS = Option('List of server commonNames', default=None, cmd="--ssl-cns", cf=('communication', 'serverCommonNames'), odesc='', cook=list_split, long_arg=True) -CLIENT_PROFILE = Option('assert the given profile for the host', +CLIENT_PROFILE = Option('Assert the given profile for the host', default=False, cmd='-p', odesc="") -CLIENT_RETRIES = Option('the number of times to retry network communication', +CLIENT_RETRIES = Option('The number of times to retry network communication', default='3', cmd='-R', cf=('communication', 'retries'), odesc="") -CLIENT_DRYRUN = Option('do not actually change the system', +CLIENT_DRYRUN = Option('Do not actually change the system', default=False, cmd='-n', ) CLIENT_EXTRA_DISPLAY = Option('enable extra entry output', default=False, cmd='-e', ) -CLIENT_PARANOID = Option('make automatic backups of config files', +CLIENT_PARANOID = Option('Make automatic backups of config files', default=False, cmd='-P', cf=('client', 'paranoid')) CLIENT_DRIVERS = Option('Specify tool driver set', cmd='-D', cf=('client', 'drivers'), odesc="", cook=list_split, default=Bcfg2.Client.Tools.default) -CLIENT_CACHE = Option('store the configuration in a file', +CLIENT_CACHE = Option('Store the configuration in a file', default=False, cmd='-c', odesc="") -CLIENT_REMOVE = Option('force removal of additional configuration items', +CLIENT_REMOVE = Option('Force removal of additional configuration items', default=False, cmd='-r', odesc="") -CLIENT_BUNDLE = Option('only configure the given bundle(s)', default=[], +CLIENT_BUNDLE = Option('Only configure the given bundle(s)', default=[], cmd='-b', odesc='', cook=colon_split) CLIENT_BUNDLEQUICK = Option('only verify/configure the given bundle(s)', default=False, cmd='-Q') -CLIENT_INDEP = Option('only configure the given bundle(s)', default=False, +CLIENT_INDEP = Option('Only configure the given bundle(s)', default=False, cmd='-z') -CLIENT_KEVLAR = Option('run in kevlar (bulletproof) mode', default=False, +CLIENT_KEVLAR = Option('Run in kevlar (bulletproof) mode', default=False, cmd='-k', ) -CLIENT_DLIST = Option('run client in server decision list mode', default=False, +CLIENT_DLIST = Option('Run client in server decision list mode', default=False, cmd='-l', odesc='') -CLIENT_FILE = Option('configure from a file rather than querying the server', +CLIENT_FILE = Option('Configure from a file rather than querying the server', default=False, cmd='-f', odesc='') -CLIENT_QUICK = Option('disable some checksum verification', default=False, +CLIENT_QUICK = Option('Disable some checksum verification', default=False, cmd='-q', ) -CLIENT_USER = Option('the user to provide for authentication', default='root', +CLIENT_USER = Option('The user to provide for authentication', default='root', cmd='-u', cf=('communication', 'user'), odesc='') CLIENT_SERVICE_MODE = Option('Set client service mode', default='default', cmd='-s', odesc='') @@ -316,7 +316,7 @@ CLIENT_APT_TOOLS_VAR_PATH = Option('Apt tools var path', CLIENT_SYSTEM_ETC_PATH = Option('System etc path', cf=('APT', 'etc_path'), default='/etc') -#Logging options +# Logging options LOGGING_FILE_PATH = Option('Set path of file log', default=None, cmd='-o', odesc='', cf=('logging', 'path')) -- cgit v1.2.3-1-g7c22 From b59e3c45b6c0fc0cadcc4bd0f2cf7550d77993c5 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 20 Dec 2010 08:02:11 +0100 Subject: Line break added (cherry picked from commit d20f2afc2d44c844b8e196647424e1ff72a27d64) --- src/lib/Server/Admin/Bundle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Bundle.py b/src/lib/Server/Admin/Bundle.py index efbe2b486..96a7ba59d 100644 --- a/src/lib/Server/Admin/Bundle.py +++ b/src/lib/Server/Admin/Bundle.py @@ -10,7 +10,7 @@ class Bundle(Bcfg2.Server.Admin.MetadataCore): __shorthelp__ = "Create or delete bundle entries" __longhelp__ = (__shorthelp__ + #"\n\nbcfg2-admin bundle add " #"\n\nbcfg2-admin bundle del " - "\nbcfg2-admin bundle list-xml" + "\n\nbcfg2-admin bundle list-xml" "\nbcfg2-admin bundle list-genshi" "\nbcfg2-admin bundle show\n") __usage__ = ("bcfg2-admin bundle [options] [add|del] [group]") -- cgit v1.2.3-1-g7c22 From cf82c2d4ea0c3fe1ef272802086446592fdd2942 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Dec 2010 16:23:00 +0100 Subject: Comment (cherry picked from commit 6dfdbbeb9b10694845ed0e246902e77c525f0e8c) --- src/lib/Server/Admin/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/__init__.py b/src/lib/Server/Admin/__init__.py index a22d8521a..dc3dc8c01 100644 --- a/src/lib/Server/Admin/__init__.py +++ b/src/lib/Server/Admin/__init__.py @@ -94,7 +94,7 @@ class Mode(object): item in col]) for col in cols] borderline = vdelim.join([w*hdelim for w in colWidths]) - # print out the table + # Print out the table print(borderline) for row in rows: print(vdelim.join([justify(str(item), width) for \ -- cgit v1.2.3-1-g7c22 From b61afa3e10e9f6b1caa568bd9974e0e221a34f4b Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Dec 2010 16:39:31 +0100 Subject: Description fixed (cherry picked from commit 8acbe8220c4fec09073933a5e461a06c00d99b81) --- src/lib/Server/Admin/Backup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Backup.py b/src/lib/Server/Admin/Backup.py index 27a7fd8c8..3297a4ae7 100644 --- a/src/lib/Server/Admin/Backup.py +++ b/src/lib/Server/Admin/Backup.py @@ -6,7 +6,7 @@ import Bcfg2.Server.Admin import Bcfg2.Options class Backup(Bcfg2.Server.Admin.MetadataCore): - __shorthelp__ = "Make a backup of the Bcfg2 repository." + __shorthelp__ = "Make a backup of the Bcfg2 repository" __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin backup") #"\n\nbcfg2-admin backup restore") __usage__ = ("bcfg2-admin backup") -- cgit v1.2.3-1-g7c22 From ac417d0d1fdcb6c8fd0c758746520519a4d726d7 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Dec 2010 16:43:58 +0100 Subject: Help layout fixed (cherry picked from commit 4f7fedd6cb1c5a6c82f6bc28da6052e0c0f47312) --- src/lib/Server/Admin/Client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Client.py b/src/lib/Server/Admin/Client.py index 0eee22ae4..08bd34151 100644 --- a/src/lib/Server/Admin/Client.py +++ b/src/lib/Server/Admin/Client.py @@ -5,11 +5,11 @@ from Bcfg2.Server.Plugins.Metadata import MetadataConsistencyError class Client(Bcfg2.Server.Admin.MetadataCore): __shorthelp__ = "Create, delete, or modify client entries" __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin client add " - "attr1=val1 attr2=val2\n" - "\n\nbcfg2-admin client update " - "attr1=val1 attr2=val2\n" - "\n\nbcfg2-admin client list\n" - "bcfg2-admin client del ") + "attr1=val1 attr2=val2" + "\nbcfg2-admin client update " + "attr1=val1 attr2=val2" + "\nbcfg2-admin client list" + "\nbcfg2-admin client del \n") __usage__ = ("bcfg2-admin client [options] [add|del|update|list] [attr=val]") def __init__(self, configfile): -- cgit v1.2.3-1-g7c22 From 01af7fdea006b05925864b9feca137a30683c66b Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Dec 2010 16:44:25 +0100 Subject: Help layout fixed (cherry picked from commit 54b6e4a1a79bace39de2ac542d132de2fc57682d) --- src/lib/Server/Admin/Group.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Group.py b/src/lib/Server/Admin/Group.py index 6a1c13775..d4024686d 100644 --- a/src/lib/Server/Admin/Group.py +++ b/src/lib/Server/Admin/Group.py @@ -5,11 +5,11 @@ from Bcfg2.Server.Plugins.Metadata import MetadataConsistencyError class Group(Bcfg2.Server.Admin.MetadataCore): __shorthelp__ = "Create, delete, or modify group entries" __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin group add " - "attr1=val1 attr2=val2\n" - "\n\nbcfg2-admin group update " - "attr1=val1 attr2=val2\n" - "\n\nbcfg2-admin group list\n" - "bcfg2-admin group del ") + "attr1=val1 attr2=val2" + "\nbcfg2-admin group update " + "attr1=val1 attr2=val2" + "\nbcfg2-admin group list" + "bcfg2-admin group del \n") __usage__ = ("bcfg2-admin group [options] [add|del|update|list] [attr=val]") def __init__(self, configfile): -- cgit v1.2.3-1-g7c22 From 47ab0c73a9d1863f11e30a073ae5be032d56af46 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Dec 2010 16:44:53 +0100 Subject: Help layout fixed (cherry picked from commit 860352cc111fc01c42a86d1f648c9acad3a055c9) --- src/lib/Server/Admin/Backup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Backup.py b/src/lib/Server/Admin/Backup.py index 3297a4ae7..fefc9fc9e 100644 --- a/src/lib/Server/Admin/Backup.py +++ b/src/lib/Server/Admin/Backup.py @@ -7,7 +7,7 @@ import Bcfg2.Options class Backup(Bcfg2.Server.Admin.MetadataCore): __shorthelp__ = "Make a backup of the Bcfg2 repository" - __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin backup") + __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin backup\n") #"\n\nbcfg2-admin backup restore") __usage__ = ("bcfg2-admin backup") -- cgit v1.2.3-1-g7c22 From 0c62d0bba25006f76a2c184871f244f3860af016 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Dec 2010 16:46:01 +0100 Subject: Help layout fixed (cherry picked from commit 96f3dc03d08b1322587971cd327c213834892aae) --- src/lib/Server/Admin/Xcmd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Xcmd.py b/src/lib/Server/Admin/Xcmd.py index 80d5cfb25..8ea98b79c 100644 --- a/src/lib/Server/Admin/Xcmd.py +++ b/src/lib/Server/Admin/Xcmd.py @@ -7,7 +7,7 @@ import xmlrpclib class Xcmd(Bcfg2.Server.Admin.Mode): __shorthelp__ = ("XML-RPC Command Interface") - __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin xcmd command") + __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin xcmd command\n") __usage__ = ("bcfg2-admin xcmd ") def __call__(self, args): -- cgit v1.2.3-1-g7c22 From 3cc72a5edf5d9b3e1ac64658610e4cd38074b638 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Dec 2010 16:46:53 +0100 Subject: Help layout fixed (cherry picked from commit 027abccc723a0985afa9096c31b1e071914583dc) --- src/lib/Server/Admin/Viz.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Viz.py b/src/lib/Server/Admin/Viz.py index 245ca8398..e3daea84b 100644 --- a/src/lib/Server/Admin/Viz.py +++ b/src/lib/Server/Admin/Viz.py @@ -6,7 +6,7 @@ class Viz(Bcfg2.Server.Admin.MetadataCore): __shorthelp__ = "Produce graphviz diagrams of metadata structures" __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin viz [--includehosts] " "[--includebundles] [--includekey] " - "[-o output.png] [--raw]") + "[-o output.png] [--raw]\n") __usage__ = ("bcfg2-admin viz [options]\n\n" " %-25s%s\n" " %-25s%s\n" @@ -24,6 +24,7 @@ class Viz(Bcfg2.Server.Admin.MetadataCore): colors = ['steelblue1', 'chartreuse', 'gold', 'magenta', 'indianred1', 'limegreen', 'orange1', 'lightblue2', 'green1', 'blue1', 'yellow1', 'darkturquoise', 'gray66'] + plugin_blacklist = ['DBStats', 'Snapshots', 'Cfg', 'Pkgmgr', 'Packages', 'Rules', 'Account', 'Decisions', 'Deps', 'Git', 'Svn', 'Fossil', 'Bzr', 'Bundler', 'TGenshi', 'SGenshi', 'Base'] -- cgit v1.2.3-1-g7c22 From 2c86aa91d280eb4e5982fc2233fd2dd205995da6 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Dec 2010 16:47:28 +0100 Subject: Help layout fixed (cherry picked from commit 17eda76a2ca5d464b05a97e7e5e7356f221c390f) --- src/lib/Server/Admin/Tidy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Tidy.py b/src/lib/Server/Admin/Tidy.py index c02ddf110..cc8ab4f5e 100644 --- a/src/lib/Server/Admin/Tidy.py +++ b/src/lib/Server/Admin/Tidy.py @@ -6,7 +6,7 @@ import Bcfg2.Server.Admin class Tidy(Bcfg2.Server.Admin.Mode): __shorthelp__ = "Clean up useless files in the repo" - __longhelp__ = __shorthelp__ + "\n\nbcfg2-admin tidy [-f] [-I]" + __longhelp__ = __shorthelp__ + "\n\nbcfg2-admin tidy [-f] [-I]\n" __usage__ = ("bcfg2-admin tidy [options]\n\n" " %-25s%s\n" " %-25s%s\n" % -- cgit v1.2.3-1-g7c22 From 9e7a2039f75b6cf0659d1b3c9ad076502f61edef Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Dec 2010 16:49:49 +0100 Subject: Help layout fixed (cherry picked from commit 21fa57fc48e90c96849918fd7059d04daa01f123) --- src/lib/Server/Admin/Pull.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Pull.py b/src/lib/Server/Admin/Pull.py index 289852f79..926eda1b3 100644 --- a/src/lib/Server/Admin/Pull.py +++ b/src/lib/Server/Admin/Pull.py @@ -9,7 +9,7 @@ class Pull(Bcfg2.Server.Admin.MetadataCore): __shorthelp__ = ("Integrate configuration information " "from clients into the server repository") __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin pull [-v] [-f][-I] [-s] " - " ") + " \n") __usage__ = ("bcfg2-admin pull [options] " "\n\n" " %-25s%s\n" @@ -117,7 +117,7 @@ class Pull(Bcfg2.Server.Admin.MetadataCore): new_entry = self.BuildNewEntry(client, etype, ename) meta = self.bcore.build_metadata(client) - # find appropriate plugin in bcore + # Find appropriate plugin in bcore glist = [gen for gen in self.bcore.generators if ename in gen.Entries.get(etype, {})] if len(glist) != 1: @@ -135,7 +135,7 @@ class Pull(Bcfg2.Server.Admin.MetadataCore): except Bcfg2.Server.Plugin.PluginExecutionError: self.errExit("Configuration upload not supported by plugin %s" \ % (plugin.name)) - # commit if running under a VCS + # Commit if running under a VCS for vcsplugin in self.bcore.plugins.values(): if isinstance(vcsplugin, Bcfg2.Server.Plugin.Version): files = "%s/%s" % (plugin.data, ename) -- cgit v1.2.3-1-g7c22 From 106827dc521482fa25b7ad67e6658b3ec0caa518 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Dec 2010 16:52:32 +0100 Subject: Longhelp added (cherry picked from commit e64dd5fc75ac7510e2cb43d53b9ecd23ee9ed405) --- src/lib/Server/Admin/Snapshots.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Snapshots.py b/src/lib/Server/Admin/Snapshots.py index 004de0ddb..d58873174 100644 --- a/src/lib/Server/Admin/Snapshots.py +++ b/src/lib/Server/Admin/Snapshots.py @@ -1,7 +1,7 @@ from datetime import date import sys -# prereq issues can be signaled with ImportError, so no try needed +# Prereq issues can be signaled with ImportError, so no try needed import sqlalchemy, sqlalchemy.orm import Bcfg2.Server.Admin import Bcfg2.Server.Snapshots @@ -11,14 +11,15 @@ from Bcfg2.Server.Snapshots.model import Snapshot, Client, Metadata, Base, \ class Snapshots(Bcfg2.Server.Admin.Mode): __shorthelp__ = "Interact with the Snapshots system" - __longhelp__ = (__shorthelp__) + __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin snapshots init" + "\nbcfg2-admin query qtype\n") __usage__ = ("bcfg2-admin snapshots [init|query qtype]") - q_dispatch = {'client':Client, - 'group':Group, - 'metadata':Metadata, - 'package':Package, - 'snapshot':Snapshot} + q_dispatch = {'client': Client, + 'group': Group, + 'metadata': Metadata, + 'package': Package, + 'snapshot': Snapshot} def __init__(self, configfile): Bcfg2.Server.Admin.Mode.__init__(self, configfile) -- cgit v1.2.3-1-g7c22 From d6f1d689ea9df196a29d1cfb1a09df837fde92d0 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Dec 2010 16:54:12 +0100 Subject: Help layout changed (cherry picked from commit de689dcca60543d6f3841afd11c05ce320df9da9) --- src/lib/Server/Admin/Perf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Perf.py b/src/lib/Server/Admin/Perf.py index 6f1cb8dbb..095180592 100644 --- a/src/lib/Server/Admin/Perf.py +++ b/src/lib/Server/Admin/Perf.py @@ -6,7 +6,7 @@ import sys class Perf(Bcfg2.Server.Admin.Mode): __shorthelp__ = ("Query server for performance data") - __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin perf") + __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin perf\n") __usage__ = ("bcfg2-admin perf") def __init__(self, configfile): -- cgit v1.2.3-1-g7c22 From 70fc3466fd7e8071b7feafe66096ecef491dd867 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 1 Jan 2011 17:40:55 +0100 Subject: Line brake added (cherry picked from commit be37ebbe4d98f025bd54ab03dc5289e43889e521) --- src/lib/Server/Admin/Minestruct.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Minestruct.py b/src/lib/Server/Admin/Minestruct.py index 02edf2b75..abe1d5a7a 100644 --- a/src/lib/Server/Admin/Minestruct.py +++ b/src/lib/Server/Admin/Minestruct.py @@ -9,7 +9,7 @@ class Minestruct(Bcfg2.Server.Admin.StructureMode): __shorthelp__ = "Extract extra entry lists from statistics" __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin minestruct [-f filename] " - "[-g groups] client") + "[-g groups] client\n") __usage__ = ("bcfg2-admin minestruct [options] \n\n" " %-25s%s\n" " %-25s%s\n" % -- cgit v1.2.3-1-g7c22 From 00c320f0de5d45a4fb6adcf29405760b8826642a Mon Sep 17 00:00:00 2001 From: Your name Date: Mon, 3 Jan 2011 09:49:19 +0100 Subject: Ask for details about the key (cherry picked from commit fbabad08f4dbe98c74e55f5b6fa4a4e371fcea56) --- src/lib/Server/Admin/Init.py | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py index 3a461681b..fa4b2ae25 100644 --- a/src/lib/Server/Admin/Init.py +++ b/src/lib/Server/Admin/Init.py @@ -123,11 +123,11 @@ def gen_password(length): newpasswd = newpasswd + random.choice(chars) return newpasswd -def create_key(hostname, keypath, certpath): +def create_key(hostname, keypath, certpath, country, state, location): """Creates a bcfg2.key at the directory specifed by keypath.""" - kcstr = "openssl req -batch -x509 -nodes -subj '/C=US/ST=Illinois/L=Argonne/CN=%s' -days 1000 -newkey rsa:2048 -keyout %s -noout" % (hostname, keypath) + kcstr = "openssl req -batch -x509 -nodes -subj '/C=%s/ST=%s/L=%s/CN=%s' -days 1000 -newkey rsa:2048 -keyout %s -noout" % (country, state, location, hostname, keypath) subprocess.call((kcstr), shell=True) - ccstr = "openssl req -batch -new -subj '/C=US/ST=Illinois/L=Argonne/CN=%s' -key %s | openssl x509 -req -days 1000 -signkey %s -out %s" % (hostname, keypath, keypath, certpath) + ccstr = "openssl req -batch -new -subj '/C=%s/ST=%s/L=%s/CN=%s' -key %s | openssl x509 -req -days 1000 -signkey %s -out %s" % (country, state, location, hostname, keypath, keypath, certpath) subprocess.call((ccstr), shell=True) os.chmod(keypath, 0600) @@ -144,7 +144,7 @@ def create_conf(confpath, confdata): os.chmod(confpath, 0600) except Exception, e: print("Error %s occured while trying to write configuration " - "file to '%s'\n" % + "file to '%s'.\n" % (e, confpath)) raise SystemExit(1) @@ -188,6 +188,7 @@ class Init(Bcfg2.Server.Admin.Mode): self._prompt_hostname() self._prompt_server() self._prompt_groups() + self._prompt_key() # Initialize the repository self.init_repo() @@ -202,7 +203,7 @@ class Init(Bcfg2.Server.Admin.Mode): def _prompt_config(self): """Ask for the configuration file path.""" - newconfig = raw_input("Store bcfg2 configuration in [%s]: " % + newconfig = raw_input("Store Bcfg2 configuration in [%s]: " % self.configfile) if newconfig != '': self.configfile = newconfig @@ -210,7 +211,7 @@ class Init(Bcfg2.Server.Admin.Mode): def _prompt_repopath(self): """Ask for the repository path.""" while True: - newrepo = raw_input("Location of bcfg2 repository [%s]: " % + newrepo = raw_input("Location of Bcfg2 repository [%s]: " % self.repopath) if newrepo != '': self.repopath = newrepo @@ -264,6 +265,26 @@ class Init(Bcfg2.Server.Admin.Mode): if plugins_are_valid: break + def _prompt_key(self): + """Ask for the key details (country, state, and location).""" + newcountry = raw_input("Country code for key: " + if newcountry != '': + self.country = newcountry + else + self.country = 'US' + + newstate = raw_input("State for key: " + if newstate != '': + self.state = newstate + else + self.state = 'Illinois' + + newlocation = raw_input("Location for key: " + if newlocation != '': + self.location = newlocation + else + self.location = 'Argonne' + def _init_plugins(self): """Initialize each plugin-specific portion of the repository.""" for plugin in self.plugins: -- cgit v1.2.3-1-g7c22 From dc29201c675a13157397d33da423eb5f7ec9bdd8 Mon Sep 17 00:00:00 2001 From: Your name Date: Mon, 3 Jan 2011 10:00:00 +0100 Subject: Initial mistakes fixed (cherry picked from commit 892e6251a65f772d2abfaecae17c4e950c6f6ac7) --- src/lib/Server/Admin/Init.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py index fa4b2ae25..9ed62b53f 100644 --- a/src/lib/Server/Admin/Init.py +++ b/src/lib/Server/Admin/Init.py @@ -267,22 +267,22 @@ class Init(Bcfg2.Server.Admin.Mode): def _prompt_key(self): """Ask for the key details (country, state, and location).""" - newcountry = raw_input("Country code for key: " + newcountry = raw_input("Country code for key: ") if newcountry != '': self.country = newcountry - else + else: self.country = 'US' - newstate = raw_input("State for key: " + newstate = raw_input("State for key: ") if newstate != '': self.state = newstate - else + else: self.state = 'Illinois' - newlocation = raw_input("Location for key: " + newlocation = raw_input("Location for key: ") if newlocation != '': self.location = newlocation - else + else: self.location = 'Argonne' def _init_plugins(self): @@ -318,7 +318,7 @@ class Init(Bcfg2.Server.Admin.Mode): create_conf(self.configfile, confdata) kpath = keypath + '/bcfg2.key' cpath = keypath + '/bcfg2.crt' - create_key(self.shostname, kpath, cpath) + create_key(self.shostname, kpath, cpath, self.country, self.state, self.location) # Create the repository path = "%s/%s" % (self.repopath, 'etc') -- cgit v1.2.3-1-g7c22 From 16bac4538fd1362dd23eb2f2b998033079e22837 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 3 Jan 2011 11:00:11 +0100 Subject: Description changed to match the standard openssl names (cherry picked from commit 6047e808b2f0e09560442a05da870475bcd2b7ec) Signed-off-by: Sol Jerome --- src/lib/Server/Admin/Init.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py index 9ed62b53f..c2dcd2184 100644 --- a/src/lib/Server/Admin/Init.py +++ b/src/lib/Server/Admin/Init.py @@ -188,7 +188,7 @@ class Init(Bcfg2.Server.Admin.Mode): self._prompt_hostname() self._prompt_server() self._prompt_groups() - self._prompt_key() + self._prompt_certificate() # Initialize the repository self.init_repo() @@ -265,21 +265,21 @@ class Init(Bcfg2.Server.Admin.Mode): if plugins_are_valid: break - def _prompt_key(self): + def _prompt_certificate(self): """Ask for the key details (country, state, and location).""" - newcountry = raw_input("Country code for key: ") + newcountry = raw_input("Country name (2 letter code) for certificate: ") if newcountry != '': self.country = newcountry else: self.country = 'US' - newstate = raw_input("State for key: ") + newstate = raw_input("State or Province Name (full name) for certificate: ") if newstate != '': self.state = newstate else: self.state = 'Illinois' - newlocation = raw_input("Location for key: ") + newlocation = raw_input("Locality Name (eg, city) for certificate: ") if newlocation != '': self.location = newlocation else: -- cgit v1.2.3-1-g7c22 From e8273b09264e9241b5c9c787a04f3f8bc6463c94 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 3 Jan 2011 12:46:57 +0100 Subject: Country code check added (cherry picked from commit a8352dc470ce0b0fe3400e9818d5c58c7116adca) Signed-off-by: Sol Jerome --- src/lib/Server/Admin/Init.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py index c2dcd2184..0c5b457cc 100644 --- a/src/lib/Server/Admin/Init.py +++ b/src/lib/Server/Admin/Init.py @@ -188,6 +188,7 @@ class Init(Bcfg2.Server.Admin.Mode): self._prompt_hostname() self._prompt_server() self._prompt_groups() + self._prompt_plugins() self._prompt_certificate() # Initialize the repository @@ -195,7 +196,8 @@ class Init(Bcfg2.Server.Admin.Mode): def _prompt_hostname(self): """Ask for the server hostname.""" - data = raw_input("What is the server's hostname [%s]: " % socket.getfqdn()) + data = raw_input("What is the server's hostname [%s]: " % + socket.getfqdn()) if data != '': self.shostname = data else: @@ -233,7 +235,8 @@ class Init(Bcfg2.Server.Admin.Mode): def _prompt_server(self): """Ask for the server name.""" - newserver = raw_input("Input the server location [%s]: " % self.server_uri) + newserver = raw_input("Input the server location [%s]: " % + self.server_uri) if newserver != '': self.server_uri = newserver @@ -251,7 +254,8 @@ class Init(Bcfg2.Server.Admin.Mode): continue def _prompt_plugins(self): - default = raw_input("Use default plugins? (%s) [Y/n]: " % ''.join(default_plugins)).lower() + default = raw_input("Use default plugins? (%s) [Y/n]: " % + ''.join(default_plugins)).lower() if default != 'y' or default != '': while True: plugins_are_valid = True @@ -267,9 +271,14 @@ class Init(Bcfg2.Server.Admin.Mode): def _prompt_certificate(self): """Ask for the key details (country, state, and location).""" + print "The following questions affects the certificate." + print "If there are data provided the default values are used." newcountry = raw_input("Country name (2 letter code) for certificate: ") if newcountry != '': - self.country = newcountry + if len(newcountry) > '2' or len(newcountry) < '2': + newcountry = raw_input("Country name (2 letter code) for certificate: ") + else: + self.country = newcountry else: self.country = 'US' @@ -289,7 +298,8 @@ class Init(Bcfg2.Server.Admin.Mode): """Initialize each plugin-specific portion of the repository.""" for plugin in self.plugins: if plugin == 'Metadata': - Bcfg2.Server.Plugins.Metadata.Metadata.init_repo(self.repopath, groups, self.os_sel, clients) + Bcfg2.Server.Plugins.Metadata.Metadata.init_repo(self.repopath, + groups, self.os_sel, clients) else: try: module = __import__("Bcfg2.Server.Plugins.%s" % plugin, '', @@ -318,7 +328,8 @@ class Init(Bcfg2.Server.Admin.Mode): create_conf(self.configfile, confdata) kpath = keypath + '/bcfg2.key' cpath = keypath + '/bcfg2.crt' - create_key(self.shostname, kpath, cpath, self.country, self.state, self.location) + create_key(self.shostname, kpath, cpath, self.country, + self.state, self.location) # Create the repository path = "%s/%s" % (self.repopath, 'etc') -- cgit v1.2.3-1-g7c22 From 9bc2e3d9e744c0a2901a337c7c457ee2dcd5ce4c Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 3 Jan 2011 23:05:40 +0100 Subject: Check for country changed (cherry picked from commit be721375800bf740a26b83291086e2504d128e98) Signed-off-by: Sol Jerome --- src/lib/Server/Admin/Init.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py index 0c5b457cc..d49c19fa1 100644 --- a/src/lib/Server/Admin/Init.py +++ b/src/lib/Server/Admin/Init.py @@ -188,7 +188,7 @@ class Init(Bcfg2.Server.Admin.Mode): self._prompt_hostname() self._prompt_server() self._prompt_groups() - self._prompt_plugins() + # self._prompt_plugins() self._prompt_certificate() # Initialize the repository @@ -218,7 +218,7 @@ class Init(Bcfg2.Server.Admin.Mode): if newrepo != '': self.repopath = newrepo if os.path.isdir(self.repopath): - response = raw_input("Directory %s exists. Overwrite? [y/N]:"\ + response = raw_input("Directory %s exists. Overwrite? [y/N]:" \ % self.repopath) if response.lower().strip() == 'y': break @@ -272,15 +272,19 @@ class Init(Bcfg2.Server.Admin.Mode): def _prompt_certificate(self): """Ask for the key details (country, state, and location).""" print "The following questions affects the certificate." - print "If there are data provided the default values are used." + print "If there are no data provided the default values are used." newcountry = raw_input("Country name (2 letter code) for certificate: ") if newcountry != '': - if len(newcountry) > '2' or len(newcountry) < '2': - newcountry = raw_input("Country name (2 letter code) for certificate: ") + if len(newcountry) == 2: + country = newcountry else: - self.country = newcountry + while len(newcountry) != 2: + newcountry = raw_input("2 letter country code (eg. US): ") + if len(newcountry) == 2: + country = newcountry + break else: - self.country = 'US' + country = 'US' newstate = raw_input("State or Province Name (full name) for certificate: ") if newstate != '': @@ -307,7 +311,8 @@ class Init(Bcfg2.Server.Admin.Mode): cls = getattr(module, plugin) cls.init_repo(self.repopath) except Exception, e: - print 'Plugin setup for %s failed: %s\n Check that dependencies are installed?' % (plugin, e) + print 'Plugin setup for %s failed: %s' + print 'Check that dependencies are installed?' % (plugin, e) def init_repo(self): """Setup a new repo and create the content of the configuration file.""" -- cgit v1.2.3-1-g7c22 From 901ae62249665ed813f0978ef10ed2063992f674 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 3 Jan 2011 23:13:53 +0100 Subject: Small fix (cherry picked from commit 0743aa20d0ee4c7b9cff50d814503e80efe6d433) Signed-off-by: Sol Jerome --- src/lib/Server/Admin/Init.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py index d49c19fa1..aee91b244 100644 --- a/src/lib/Server/Admin/Init.py +++ b/src/lib/Server/Admin/Init.py @@ -276,15 +276,15 @@ class Init(Bcfg2.Server.Admin.Mode): newcountry = raw_input("Country name (2 letter code) for certificate: ") if newcountry != '': if len(newcountry) == 2: - country = newcountry + self.country = newcountry else: while len(newcountry) != 2: newcountry = raw_input("2 letter country code (eg. US): ") if len(newcountry) == 2: - country = newcountry + self.country = newcountry break else: - country = 'US' + self.country = 'US' newstate = raw_input("State or Province Name (full name) for certificate: ") if newstate != '': -- cgit v1.2.3-1-g7c22