certbot_apache.augeas_configurator

Class of Augeas Configurators.

class certbot_apache.augeas_configurator.AugeasConfigurator(*args, **kwargs)[source]

Bases: certbot.plugins.common.Installer

Base Augeas Configurator class.

Variables:
  • config – Configuration.
  • aug – Augeas object
  • save_notes (str) – Human-readable configuration change notes
  • reverter – saves and reverts checkpoints
init_augeas()[source]

Initialize the actual Augeas instance

check_parsing_errors(lens)[source]

Verify Augeas can parse all of the lens files.

Parameters:lens (str) – lens to check for errors
Raises:errors.PluginError – If there has been an error in parsing with the specified lens.
ensure_augeas_state()[source]

Makes sure that all Augeas dom changes are written to files to avoid loss of configuration directives when doing additional augeas parsing, causing a possible augeas.load() resulting dom reset

unsaved_files()[source]

Lists files that have modified Augeas DOM but the changes have not been written to the filesystem yet, used by self.save() and ApacheConfigurator to check the file state.

Raises:errors.PluginError – If there was an error in Augeas, in an attempt to save the configuration, or an error creating a checkpoint
Returns:set of unsaved files
save(title=None, temporary=False)[source]

Saves all changes to the configuration files.

This function first checks for save errors, if none are found, all configuration changes made will be saved. According to the function parameters. If an exception is raised, a new checkpoint was not created.

Parameters:
  • title (str) – The title of the save. If a title is given, the configuration will be saved as a new checkpoint and put in a timestamped directory.
  • temporary (bool) – Indicates whether the changes made will be quickly reversed in the future (ie. challenges)
_log_save_errors(ex_errs)[source]

Log errors due to bad Augeas save.

Parameters:ex_errs (list) – Existing errors before save
recovery_routine()[source]

Revert all previously modified files.

Reverts all modified files that have not been saved as a checkpoint

Raises:errors.PluginError – If unable to recover the configuration
revert_challenge_config()[source]

Used to cleanup challenge configurations.

Raises:errors.PluginError – If unable to revert the challenge config.
rollback_checkpoints(rollback=1)[source]

Rollback saved checkpoints.

Parameters:rollback (int) – Number of checkpoints to revert
Raises:errors.PluginError – If there is a problem with the input or the function is unable to correctly revert the configuration