a warning should be more appropriate than crashing

This commit is contained in:
lars 2007-07-11 19:24:50 +00:00
parent 3091f07d07
commit 69e1ecbf9d
1 changed files with 9 additions and 5 deletions

View File

@ -29,7 +29,7 @@ __revision__ = "$Id$"
import cryptobox.plugins.base
import subprocess
import os, sys
import os
import cherrypy
CERT_FILENAME = 'cryptobox-ssl-certificate.pem'
@ -120,8 +120,13 @@ class encrypted_webinterface(cryptobox.plugins.base.CryptoBoxPlugin):
if event == "bootup":
cert_abs_name = self.cbox.prefs.get_misc_config_filename(CERT_FILENAME)
if not os.path.isfile(cert_abs_name):
cert = self.__get_certificate()
if cert is None:
## failed to create a certificate?
self.cbox.log.warn("Failed to import M2Crypto python module" \
+ " required for SSL certificate generation")
return
try:
cert = self.__get_certificate()
self.cbox.prefs.create_misc_config_file(CERT_FILENAME, cert)
self.cbox.log.info("Created new SSL certificate: %s" % \
cert_abs_name)
@ -217,9 +222,8 @@ class encrypted_webinterface(cryptobox.plugins.base.CryptoBoxPlugin):
try:
import M2Crypto
except ImportError:
sys.stderr.write("Plugin encrypted_webinterface could not import M2Crypto module!\n")
sys.stderr.write("Try 'apt-get install python-m2crypto'.\n")
sys.exit(1)
## failed to import the module
return None
import time
string_type = 0x1000 | 1 # see http://www.koders.com/python/..
# ../fid07A99E089F55187896A06CD4E0B6F21B9B8F5B0B.aspx?s=bavaria