From b33669edacb94dc7304fe1e28a285c55ec43de0d Mon Sep 17 00:00:00 2001 From: Joona Hoikkala Date: Mon, 15 May 2017 22:32:12 +0300 Subject: [PATCH] Force augeas file reload to recalculate span indicies (cherry picked from commit f5b61d56bde973f791b32421f8f33d0e95d5cc7d) --- certbot-apache/certbot_apache/augeas_configurator.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/certbot-apache/certbot_apache/augeas_configurator.py b/certbot-apache/certbot_apache/augeas_configurator.py index e053d0468..444fbb763 100644 --- a/certbot-apache/certbot_apache/augeas_configurator.py +++ b/certbot-apache/certbot_apache/augeas_configurator.py @@ -120,8 +120,8 @@ class AugeasConfigurator(common.Plugin): # If the augeas tree didn't change, no files were saved and a backup # should not be created + save_files = set() if save_paths: - save_files = set() for path in save_paths: save_files.add(self.aug.get(path)[6:]) @@ -140,6 +140,12 @@ class AugeasConfigurator(common.Plugin): self.save_notes = "" self.aug.save() + # Force reload if files were modified + # This is needed to recalculate augeas directive span + if save_files: + for sf in save_files: + self.aug.remove("/files/"+sf) + self.aug.load() if title and not temporary: try: self.reverter.finalize_checkpoint(title)