mirror of
https://github.com/certbot/certbot.git
synced 2026-05-28 04:34:11 -04:00
Initialize augeas in a new method
This commit is contained in:
parent
5244719bda
commit
08ccc64cd1
2 changed files with 9 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue