summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Admin
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-10-07 14:46:08 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-10-07 14:46:08 +0000
commiteac52c270b8b3b10e461bc46502b64c5f898bd7d (patch)
tree96da2e78af41305b445de23596b75bf754eedbbc /src/lib/Server/Admin
parente686d3b69600441e943c2913542e5477af528d87 (diff)
downloadbcfg2-eac52c270b8b3b10e461bc46502b64c5f898bd7d.tar.gz
bcfg2-eac52c270b8b3b10e461bc46502b64c5f898bd7d.tar.bz2
bcfg2-eac52c270b8b3b10e461bc46502b64c5f898bd7d.zip
Pylint/PEP 8 Code cleanups
Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5477 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Admin')
-rw-r--r--src/lib/Server/Admin/Client.py4
-rw-r--r--src/lib/Server/Admin/Group.py8
-rw-r--r--src/lib/Server/Admin/Init.py32
-rw-r--r--src/lib/Server/Admin/Minestruct.py8
-rw-r--r--src/lib/Server/Admin/Perf.py9
-rw-r--r--src/lib/Server/Admin/Pull.py4
-rw-r--r--src/lib/Server/Admin/Snapshots.py8
-rw-r--r--src/lib/Server/Admin/Tidy.py5
-rw-r--r--src/lib/Server/Admin/Viz.py3
9 files changed, 43 insertions, 38 deletions
diff --git a/src/lib/Server/Admin/Client.py b/src/lib/Server/Admin/Client.py
index 11853f7a2..0eee22ae4 100644
--- a/src/lib/Server/Admin/Client.py
+++ b/src/lib/Server/Admin/Client.py
@@ -25,7 +25,7 @@ class Client(Bcfg2.Server.Admin.MetadataCore):
attr_d = {}
for i in args[2:]:
attr, val = i.split('=', 1)
- if attr not in ['profile', 'uuid', 'password',
+ if attr not in ['profile', 'uuid', 'password',
'location', 'secure', 'address']:
print "Attribute %s unknown" % attr
raise SystemExit(1)
@@ -39,7 +39,7 @@ class Client(Bcfg2.Server.Admin.MetadataCore):
attr_d = {}
for i in args[2:]:
attr, val = i.split('=', 1)
- if attr not in ['profile', 'uuid', 'password',
+ if attr not in ['profile', 'uuid', 'password',
'location', 'secure', 'address']:
print "Attribute %s unknown" % attr
raise SystemExit(1)
diff --git a/src/lib/Server/Admin/Group.py b/src/lib/Server/Admin/Group.py
index c9619d534..6a1c13775 100644
--- a/src/lib/Server/Admin/Group.py
+++ b/src/lib/Server/Admin/Group.py
@@ -25,8 +25,8 @@ class Group(Bcfg2.Server.Admin.MetadataCore):
attr_d = {}
for i in args[2:]:
attr, val = i.split('=', 1)
- if attr not in ['profile', 'public', 'default',
- 'name', 'auth', 'toolset', 'category',
+ if attr not in ['profile', 'public', 'default',
+ 'name', 'auth', 'toolset', 'category',
'comment']:
print "Attribute %s unknown" % attr
raise SystemExit(1)
@@ -40,8 +40,8 @@ class Group(Bcfg2.Server.Admin.MetadataCore):
attr_d = {}
for i in args[2:]:
attr, val = i.split('=', 1)
- if attr not in ['profile', 'public', 'default',
- 'name', 'auth', 'toolset', 'category',
+ if attr not in ['profile', 'public', 'default',
+ 'name', 'auth', 'toolset', 'category',
'comment']:
print "Attribute %s unknown" % attr
raise SystemExit(1)
diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py
index c12fcf9a8..9fc2a23fe 100644
--- a/src/lib/Server/Admin/Init.py
+++ b/src/lib/Server/Admin/Init.py
@@ -75,14 +75,14 @@ os_list = [
]
# Complete list of plugins
-plugin_list = ['Account', 'Base', 'Bundler', 'Cfg',
- 'Decisions', 'Deps', 'Metadata', 'Packages',
- 'Pkgmgr', 'Probes', 'Properties', 'Rules',
- 'Snapshots', 'SSHbase', 'Statistics', 'Svcmgr',
+plugin_list = ['Account', 'Base', 'Bundler', 'Cfg',
+ 'Decisions', 'Deps', 'Metadata', 'Packages',
+ 'Pkgmgr', 'Probes', 'Properties', 'Rules',
+ 'Snapshots', 'SSHbase', 'Statistics', 'Svcmgr',
'TCheetah', 'TGenshi']
# Default list of plugins to use
-default_plugins = ['SSHbase', 'Cfg', 'Pkgmgr', 'Rules',
+default_plugins = ['SSHbase', 'Cfg', 'Pkgmgr', 'Rules',
'Metadata', 'Base', 'Bundler']
def gen_password(length):
@@ -188,13 +188,13 @@ class Init(Bcfg2.Server.Admin.Mode):
"(without echoing; leave blank for a random): ").strip()
if len(newpassword) != 0:
self.password = newpassword
-
+
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
-
+
def _prompt_groups(self):
"""Create the groups.xml file"""
prompt = '''Input base Operating System for clients:\n'''
@@ -241,15 +241,15 @@ class Init(Bcfg2.Server.Admin.Mode):
'''Setup a new repo'''
# Create the contents of the configuration file
keypath = os.path.dirname(os.path.abspath(self.configfile))
- confdata = config % (
- self.repopath,
+ confdata = config % (
+ self.repopath,
','.join(self.opts['plugins']),
- self.opts['sendmail'],
+ self.opts['sendmail'],
self.opts['proto'],
- self.password,
- keypath,
- keypath,
- self.server_uri
+ self.password,
+ keypath,
+ keypath,
+ self.server_uri
)
# Create the configuration file and SSL key
@@ -257,7 +257,7 @@ class Init(Bcfg2.Server.Admin.Mode):
create_key(keypath)
# Create the repository
- path = "%s/%s" % (self.repopath, 'etc')
+ path = "%s/%s" % (self.repopath, 'etc')
os.makedirs(path)
self._init_plugins()
print "Repository created successfuly in %s" % (self.repopath)
diff --git a/src/lib/Server/Admin/Minestruct.py b/src/lib/Server/Admin/Minestruct.py
index d5af2f809..f1ffa129a 100644
--- a/src/lib/Server/Admin/Minestruct.py
+++ b/src/lib/Server/Admin/Minestruct.py
@@ -1,6 +1,9 @@
'''Minestruct Admin Mode'''
+import getopt
+import lxml.etree
+import sys
+
import Bcfg2.Server.Admin
-import lxml.etree, sys, getopt
class Minestruct(Bcfg2.Server.Admin.StructureMode):
'''Pull extra entries out of statistics'''
@@ -30,7 +33,7 @@ class Minestruct(Bcfg2.Server.Admin.StructureMode):
except:
self.log.error(self.__shorthelp__)
raise SystemExit(1)
-
+
client = args[0]
output = sys.stdout
groups = []
@@ -65,4 +68,3 @@ class Minestruct(Bcfg2.Server.Admin.StructureMode):
tree = lxml.etree.ElementTree(root)
tree.write(output, pretty_print=True)
-
diff --git a/src/lib/Server/Admin/Perf.py b/src/lib/Server/Admin/Perf.py
index 3d17372e0..df6f51dd4 100644
--- a/src/lib/Server/Admin/Perf.py
+++ b/src/lib/Server/Admin/Perf.py
@@ -15,12 +15,12 @@ class Perf(Bcfg2.Server.Admin.Mode):
def __call__(self, args):
output = [('Name', 'Min', 'Max', 'Mean', 'Count')]
optinfo = {
+ 'ca': Bcfg2.Options.CLIENT_CA
+ 'certificate': Bcfg2.Options.CLIENT_CERT,
+ 'key': Bcfg2.Options.SERVER_KEY,
+ 'password': Bcfg2.Options.SERVER_PASSWORD,
'server': Bcfg2.Options.SERVER_LOCATION,
'user': Bcfg2.Options.CLIENT_USER,
- 'password': Bcfg2.Options.SERVER_PASSWORD,
- 'key': Bcfg2.Options.SERVER_KEY,
- 'certificate' : Bcfg2.Options.CLIENT_CERT,
- 'ca' : Bcfg2.Options.CLIENT_CA
}
setup = Bcfg2.Options.OptionParser(optinfo)
setup.parse(sys.argv[2:])
@@ -35,4 +35,3 @@ class Perf(Bcfg2.Server.Admin.Mode):
data = tuple(["%.06f" % (item) for item in value[:-1]] + [value[-1]])
output.append((key, ) + data)
self.print_table(output)
-
diff --git a/src/lib/Server/Admin/Pull.py b/src/lib/Server/Admin/Pull.py
index 81ae9c433..993dbc0c5 100644
--- a/src/lib/Server/Admin/Pull.py
+++ b/src/lib/Server/Admin/Pull.py
@@ -28,7 +28,7 @@ class Pull(Bcfg2.Server.Admin.MetadataCore):
self.__usage__)
self.log = False
self.mode = 'interactive'
-
+
def __call__(self, args):
Bcfg2.Server.Admin.Mode.__call__(self, args)
try:
@@ -76,7 +76,7 @@ class Pull(Bcfg2.Server.Admin.MetadataCore):
for choice in choices:
print "Plugin returned choice:"
if id(choice) == id(choices[0]):
- print "(current entry)",
+ print "(current entry)",
if choice.all:
print " => global entry"
elif choice.group:
diff --git a/src/lib/Server/Admin/Snapshots.py b/src/lib/Server/Admin/Snapshots.py
index cda8a3cd4..c7ea3a376 100644
--- a/src/lib/Server/Admin/Snapshots.py
+++ b/src/lib/Server/Admin/Snapshots.py
@@ -146,10 +146,10 @@ class Snapshots(Bcfg2.Server.Admin.Mode):
rows = []
labels = ('Client', 'Correct', 'Revision', 'Time')
for snap in snaps:
- rows.append([snap.client.name,
- snap.correct,
- snap.revision,
- snap.timestamp])
+ rows.append([snap.client.name,
+ snap.correct,
+ snap.revision,
+ snap.timestamp])
self.print_table([labels]+rows,
justify='left',
hdr=True,
diff --git a/src/lib/Server/Admin/Tidy.py b/src/lib/Server/Admin/Tidy.py
index 5f3145602..3e51d9d75 100644
--- a/src/lib/Server/Admin/Tidy.py
+++ b/src/lib/Server/Admin/Tidy.py
@@ -1,5 +1,8 @@
+import os
+import re
+import socket
+
import Bcfg2.Server.Admin
-import re, os, socket
class Tidy(Bcfg2.Server.Admin.Mode):
__shorthelp__ = "Clean up useless files in the repo"
diff --git a/src/lib/Server/Admin/Viz.py b/src/lib/Server/Admin/Viz.py
index 3945591f7..f49df37e8 100644
--- a/src/lib/Server/Admin/Viz.py
+++ b/src/lib/Server/Admin/Viz.py
@@ -44,7 +44,8 @@ class Viz(Bcfg2.Server.Admin.MetadataCore):
except getopt.GetoptError, msg:
print msg
- rset = False
+ #FIXME: is this for --raw?
+ #rset = False
hset = False
bset = False
kset = False