mirror of
https://github.com/certbot/certbot.git
synced 2026-07-27 16:30:31 +02:00
Initialize augeas in a new method
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
"""Class of Augeas Configurators."""
|
||||
import logging
|
||||
|
||||
import augeas
|
||||
|
||||
from certbot import errors
|
||||
from certbot import reverter
|
||||
@@ -29,6 +28,9 @@ class AugeasConfigurator(common.Plugin):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(AugeasConfigurator, self).__init__(*args, **kwargs)
|
||||
|
||||
def init_augeas(self):
|
||||
""" Initialize the actual Augeas instance """
|
||||
import augeas
|
||||
self.aug = augeas.Augeas(
|
||||
# specify a directory to load our preferred lens from
|
||||
loadpath=constants.AUGEAS_LENS_DIR,
|
||||
|
||||
@@ -150,6 +150,12 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
||||
:raises .errors.PluginError: If there is any other error
|
||||
|
||||
"""
|
||||
# Perform the actual Augeas initialization to be able to react
|
||||
try:
|
||||
self.init_augeas()
|
||||
except ImportError:
|
||||
raise errors.NoInstallationError("Problem in Augeas installation")
|
||||
|
||||
# Verify Apache is installed
|
||||
if not util.exe_exists(constants.os_constant("restart_cmd")[0]):
|
||||
raise errors.NoInstallationError
|
||||
|
||||
Reference in New Issue
Block a user