summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-03-16 20:51:01 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-03-16 20:51:01 +0000
commit555f0d2cb8dc4004afbd780c2b24781c64d31d33 (patch)
treeb4dd7da519102010dd7d33f30a81ec692c6295a0
parentcad14d9d1c660b70b934e1f2d153f93dee1062a5 (diff)
downloadbcfg2-555f0d2cb8dc4004afbd780c2b24781c64d31d33.tar.gz
bcfg2-555f0d2cb8dc4004afbd780c2b24781c64d31d33.tar.bz2
bcfg2-555f0d2cb8dc4004afbd780c2b24781c64d31d33.zip
Remove some FIXMEs in bcfg2-admin init
Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5124 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Server/Admin/Init.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py
index af307ec4e..2d53c3548 100644
--- a/src/lib/Server/Admin/Init.py
+++ b/src/lib/Server/Admin/Init.py
@@ -76,8 +76,7 @@ os_list = [
class Init(Bcfg2.Server.Admin.Mode):
- __shorthelp__ = ("Compare two client specifications or "
- "directories of specifications") # FIXME
+ __shorthelp__ = ("Interactively initialize a new repository")
__longhelp__ = __shorthelp__ + "\n\nbcfg2-admin init"
__usage__ = "bcfg2-admin init"
options = {
@@ -87,14 +86,14 @@ class Init(Bcfg2.Server.Admin.Mode):
'repo' : Bcfg2.Options.SERVER_REPOSITORY,
'sendmail' : Bcfg2.Options.SENDMAIL_PATH,
}
+ repopath = ""
+ response = ""
def __call__(self, args):
Bcfg2.Server.Admin.Mode.__call__(self, args)
opts = Bcfg2.Options.OptionParser(self.options)
opts.parse([])
- self.response = ""
- # FIXME don't overwrite existing bcfg2.conf file
configfile = raw_input("Store bcfg2 configuration in [%s]: " %
opts['configfile'])
if configfile == '':
@@ -146,12 +145,18 @@ class Init(Bcfg2.Server.Admin.Mode):
password, keypath, server_uri
)
- try:
- open(configfile, "w").write(confdata)
- os.chmod(configfile, 0600)
- except:
- # FIXME how to handle
- print "Failed to write configuration file to '%s'\n" % configfile
+ # don't overwrite existing bcfg2.conf file
+ if os.path.exists(configfile):
+ print("\nWarning: %s already exists. Will not be "
+ "overwritten...\n" % configfile)
+ else:
+ try:
+ open(configfile, "w").write(confdata)
+ os.chmod(configfile, 0600)
+ except Exception, e:
+ print("Error %s occured while trying to write configuration "
+ "file to '%s'\n" %
+ (e, configfile))
# FIXME automate ssl key generation
# FIXME key generation may fail as non-root user