summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2010-02-24 16:23:55 +0000
committerSol Jerome <solj@ices.utexas.edu>2010-02-24 16:23:55 +0000
commitb9da5b7b1eb0a0782201eb3de73b2ef4bb7548fc (patch)
treebe113395d3e734072deac07022b059e3aa9c7924 /src
parenteb74c76c6dcf3da2a09831503c2d03453100e0b5 (diff)
downloadbcfg2-b9da5b7b1eb0a0782201eb3de73b2ef4bb7548fc.tar.gz
bcfg2-b9da5b7b1eb0a0782201eb3de73b2ef4bb7548fc.tar.bz2
bcfg2-b9da5b7b1eb0a0782201eb3de73b2ef4bb7548fc.zip
bcfg2-server: Add sanity check for bcfg2.conf (Resolves Ticket #797)
Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5742 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Component.py2
-rwxr-xr-xsrc/sbin/bcfg2-server4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/Component.py b/src/lib/Component.py
index 33ed635af..1a4c35d02 100644
--- a/src/lib/Component.py
+++ b/src/lib/Component.py
@@ -24,7 +24,7 @@ class NoExposedMethod (Exception):
"""There is no method exposed with the given name."""
def run_component(component_cls, location, daemon, pidfile_name, to_file,
- cfile='/etc/bcfg2.conf', argv=None, register=True,
+ cfile, argv=None, register=True,
state_name=False, cls_kwargs={}, extra_getopt='', time_out=10,
protocol='xmlrpc/ssl', certfile=None, keyfile=None, ca=None):
diff --git a/src/sbin/bcfg2-server b/src/sbin/bcfg2-server
index 5c058bc2a..73802965e 100755
--- a/src/sbin/bcfg2-server
+++ b/src/sbin/bcfg2-server
@@ -4,6 +4,7 @@
__revision__ = '$Revision$'
import logging
+import os.path
import sys
import Bcfg2.Logger
@@ -45,6 +46,9 @@ if __name__ == '__main__':
setup = Bcfg2.Options.OptionParser(OPTINFO)
setup.parse(sys.argv[1:])
try:
+ # check whether the specified bcfg2.conf exists
+ if not os.path.exists(setup['configfile']):
+ raise CoreInitError, "Could not read %s" % setup['configfile']
Bcfg2.Component.run_component(Bcfg2.Server.Core.Core,
location=setup['location'],
daemon = setup['daemon'],