summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Admin
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-01-08 01:28:12 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-01-08 01:28:12 +0000
commitf2643329b73333da4037bd1f0e7186793c7195e6 (patch)
treed5501e7c91a65587c89dbec602a6722d23dab112 /src/lib/Server/Admin
parent3ac7454263931f22b2700e078544c6056cc71509 (diff)
downloadbcfg2-f2643329b73333da4037bd1f0e7186793c7195e6.tar.gz
bcfg2-f2643329b73333da4037bd1f0e7186793c7195e6.tar.bz2
bcfg2-f2643329b73333da4037bd1f0e7186793c7195e6.zip
Admin fixups
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4196 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/Init.py9
-rw-r--r--src/lib/Server/Admin/Tidy.py8
-rw-r--r--src/lib/Server/Admin/Viz.py3
4 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/Server/Admin/Client.py b/src/lib/Server/Admin/Client.py
index d08ff1283..682c12013 100644
--- a/src/lib/Server/Admin/Client.py
+++ b/src/lib/Server/Admin/Client.py
@@ -7,7 +7,7 @@ class Client(Bcfg2.Server.Admin.Mode):
__longhelp__ = __shorthelp__ + '\n\tCreate or delete client entries'
def __init__(self):
Bcfg2.Server.Admin.Mode.__init__(self)
- self.tree = lxml.etree.parse(self.repo_path + \
+ self.tree = lxml.etree.parse(self.get_repo_path() + \
'/Metadata/clients.xml')
self.root = self.tree.getroot()
@@ -28,7 +28,7 @@ class Client(Bcfg2.Server.Admin.Mode):
else:
print "No command specified"
raise SystemExit(1)
- self.tree.write(self.repopath + '/Metadata/clients.xml')
+ self.tree.write(self.get_repo_path() + '/Metadata/clients.xml')
def AddClient(self, client, attrs):
'''add a new client'''
diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py
index 7a18c9287..7b934b22e 100644
--- a/src/lib/Server/Admin/Init.py
+++ b/src/lib/Server/Admin/Init.py
@@ -72,11 +72,12 @@ class Init(Bcfg2.Server.Admin.Mode):
'struct': Bcfg2.Options.SERVER_STRUCTURES,
'gens': Bcfg2.Options.SERVER_GENERATORS,
'proto': Bcfg2.Options.SERVER_PROTOCOL,
- 'sendmail': Bcfg2.Options.SENDMAIL_PATH}
+ 'sendmail': Bcfg2.Options.SENDMAIL_PATH,
+ 'configfile': Bcfg2.Options.CFILE}
def __call__(self, args):
Bcfg2.Server.Admin.Mode.__call__(self, args)
- opts = Bcfg2.Options.OptionParser(options)
+ opts = Bcfg2.Options.OptionParser(self.options)
opts.parse([])
repopath = raw_input("location of bcfg2 repository [%s]: " % opts['repo'])
if repopath == '':
@@ -100,14 +101,14 @@ class Init(Bcfg2.Server.Admin.Mode):
def initializeRepo(self, repo, server_uri, password, os_selection, opts):
'''Setup a new repo'''
- keypath = os.path.dirname(os.path.abspath(settings.CONFIG_FILE))
+ keypath = os.path.dirname(os.path.abspath(opts['configfile']))
confdata = config % (
repo, opts['struct'], opts['gens'],
opts['sendmail'], opts['proto'],
password, keypath, server_uri
)
- open(settings.CONFIG_FILE,"w").write(confdata)
+ open(opts['configfile'], "w").write(confdata)
# FIXME automate ssl key generation
os.popen('openssl req -x509 -nodes -days 1000 -newkey rsa:1024 -out %s/bcfg2.key -keyout %s/bcfg2.key' % (keypath, keypath))
try:
diff --git a/src/lib/Server/Admin/Tidy.py b/src/lib/Server/Admin/Tidy.py
index 3cbe778b8..aafd7b9a7 100644
--- a/src/lib/Server/Admin/Tidy.py
+++ b/src/lib/Server/Admin/Tidy.py
@@ -30,7 +30,7 @@ class Tidy(Bcfg2.Server.Admin.Mode):
bad = []
# clean up unresolvable hosts in SSHbase
- for name in os.listdir("%s/SSHbase" % (self.repo_path)):
+ for name in os.listdir("%s/SSHbase" % (self.get_repo_path())):
if hostmatcher.match(name):
hostname = hostmatcher.match(name).group(1)
if hostname in good + bad:
@@ -40,12 +40,12 @@ class Tidy(Bcfg2.Server.Admin.Mode):
good.append(hostname)
except:
bad.append(hostname)
- for name in os.listdir("%s/SSHbase" % (self.repo_path)):
+ for name in os.listdir("%s/SSHbase" % (self.get_repo_path())):
if not hostmatcher.match(name):
- to_remove.append("%s/SSHbase/%s" % (self.repo_path, name))
+ to_remove.append("%s/SSHbase/%s" % (self.get_repo_path(), name))
else:
if hostmatcher.match(name).group(1) in bad:
- to_remove.append("%s/SSHbase/%s" % (self.repo_path, name))
+ to_remove.append("%s/SSHbase/%s" % (self.get_repo_path(), name))
# clean up file~
# clean up files without parsable names in Cfg
return to_remove
diff --git a/src/lib/Server/Admin/Viz.py b/src/lib/Server/Admin/Viz.py
index 3ebe25f92..7574683b5 100644
--- a/src/lib/Server/Admin/Viz.py
+++ b/src/lib/Server/Admin/Viz.py
@@ -38,9 +38,8 @@ class Viz(Bcfg2.Server.Admin.Mode):
kset = True
elif opt in ("-o", "--outfile"):
outputfile = arg
- repopath = self.repo_path
- data = self.Visualize(repopath, rset, hset, bset, kset)
+ data = self.Visualize(self.get_repo_path(), rset, hset, bset, kset)
if outputfile:
open(outputfile, 'w').write(data)
else: