summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Gogolok <gogo@cs.uni-sb.de>2007-12-30 21:45:40 +0000
committerRobert Gogolok <gogo@cs.uni-sb.de>2007-12-30 21:45:40 +0000
commit340c282ef6232a993f5461bf51ccb410b1f1355f (patch)
treece917caae633e0c324dc41771025d4d80416fb87
parenta04628e619a753078cfb4f3a8d1739837e65be86 (diff)
downloadbcfg2-340c282ef6232a993f5461bf51ccb410b1f1355f.tar.gz
bcfg2-340c282ef6232a993f5461bf51ccb410b1f1355f.tar.bz2
bcfg2-340c282ef6232a993f5461bf51ccb410b1f1355f.zip
add SENDMAIL_PATH
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4137 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Options.py2
-rw-r--r--src/lib/Server/Admin/Init.py22
-rw-r--r--src/lib/Settings.py28
-rwxr-xr-xsrc/sbin/bcfg2-admin3
4 files changed, 32 insertions, 23 deletions
diff --git a/src/lib/Options.py b/src/lib/Options.py
index aab329f4d..5ceb7c377 100644
--- a/src/lib/Options.py
+++ b/src/lib/Options.py
@@ -1,7 +1,7 @@
'''Option parsing library for utilities'''
__revision__ = '$Revision$'
-import getopt, os, sys, ConfigParser
+import getopt, os, sys
class OptionFailure(Exception):
pass
diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py
index 5131cfb7a..0a76f44a7 100644
--- a/src/lib/Server/Admin/Init.py
+++ b/src/lib/Server/Admin/Init.py
@@ -6,11 +6,11 @@ from Bcfg2.Settings import settings
config = '''
[server]
repository = %s
-structures = Bundler,Base
-generators = SSHbase,Cfg,Pkgmgr,Rules
+structures = %s
+generators = %s
[statistics]
-sendmailpath = /usr/sbin/sendmail
+sendmailpath = %s
database_engine = sqlite3
# 'postgresql', 'mysql', 'mysql_old', 'sqlite3' or 'ado_mssql'.
database_name =
@@ -28,7 +28,7 @@ web_debug = True
[communication]
-protocol = xmlrpc/ssl
+protocol = %s
password = %s
key = %s/bcfg2.key
@@ -71,9 +71,9 @@ class Init(Bcfg2.Server.Admin.Mode):
__longhelp__ = __shorthelp__ + '\n\tCompare two client specifications or directories of specifications'
def __call__(self, args):
Bcfg2.Server.Admin.Mode.__call__(self, args)
- repopath = raw_input( "location of bcfg2 repository [/var/lib/bcfg2]: " )
+ repopath = raw_input( "location of bcfg2 repository [%s]: " % settings.SERVER_REPOSITORY )
if repopath == '':
- repopath = '/var/lib/bcfg2'
+ repopath = settings.SERVER_REPOSITORY
password = ''
while ( password == '' ):
password = raw_input(
@@ -94,7 +94,15 @@ class Init(Bcfg2.Server.Admin.Mode):
def initializeRepo(self, repo, server_uri, password, os_selection):
'''Setup a new repo'''
keypath = os.path.dirname(os.path.abspath(settings.CONFIG_FILE))
- confdata = config % ( repo, password, keypath, server_uri )
+ confdata = config % (
+ repo,
+ settings.SERVER_STRUCTURES,
+ settings.SERVER_GENERATORS,
+ settings.SENDMAIL_PATH,
+ settings.COMMUNICATION_PROTOCOL,
+ password, keypath, server_uri
+ )
+
open(settings.CONFIG_FILE,"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))
diff --git a/src/lib/Settings.py b/src/lib/Settings.py
index 561611414..44ba3b849 100644
--- a/src/lib/Settings.py
+++ b/src/lib/Settings.py
@@ -16,9 +16,10 @@ locations = {'communication': [('COMMUNICATION_PROTOCOL', 'protocol'),
('SERVER_GENERATORS','generators'),
('SERVER_REPOSITORY', 'repository'),
('SERVER_STRUCTURES','structures'),
- ('SERVER_SVN', 'svn'),
+ ('SERVER_SVN', 'svn')],
'components': [('COMPONENTS_BCFG2', 'bcfg2'),
- ('COMPONENTS_BCFG2_STATIC', 'bcfg2')]}
+ ('COMPONENTS_BCFG2_STATIC', 'bcfg2')],
+ 'statistics': [('SENDMAIL_PATH', 'sendmai;')]}
cookers = {'COMPONENTS_BCFG2_STATIC': lambda x:True,
'SERVER_GENERATORS': lambda x:x.replace(' ','').split(','),
@@ -43,6 +44,7 @@ class Settings(object):
self.COMPONENTS_BCFG2 = (socket.gethostname(), 0)
self.COMPONENTS_BCFG2_STATIC = False
+ self.SENDMAIL_PATH = '/usr/sbin/sendmail'
def __getattr__(self, name):
print "name = %s\n" % name
@@ -76,16 +78,16 @@ class Settings(object):
logger.error("Content of config file '%s' is not valid. Correct it!\n%s\n" % (self.CONFIG_FILE, e))
raise SystemExit, 1
- for section in locations:
- if cfp.has_section(section):
- for key, location in locations[section]:
- try:
- if key in cookers:
- setattr(self, key, cookers[key](cfp.get(section,
- location)))
- else:
- setattr(self, key, cfp.get(section, location))
- except:
- pass
+ for section in locations:
+ if cfp.has_section(section):
+ for key, location in locations[section]:
+ try:
+ if key in cookers:
+ setattr(self, key, cookers[key](cfp.get(section,
+ location)))
+ else:
+ setattr(self, key, cfp.get(section, location))
+ except:
+ pass
settings = Settings()
diff --git a/src/sbin/bcfg2-admin b/src/sbin/bcfg2-admin
index 152edc62d..ba979ec3b 100755
--- a/src/sbin/bcfg2-admin
+++ b/src/sbin/bcfg2-admin
@@ -19,8 +19,7 @@ def mode_import(modename):
if __name__ == '__main__':
Bcfg2.Logging.setup_logging('bcfg2-admin', to_console=True)
- # Some sensible defaults
- configfile = "/etc/bcfg2.conf"
+ configfile = settings.CONFIG_FILE
try:
opts, args = getopt.getopt(sys.argv[1:], 'hC:', ['help', 'configfile='])