From 98e70df5e44ea893c4be49601a1e09149ad79c35 Mon Sep 17 00:00:00 2001 From: James Kasten Date: Thu, 23 May 2013 22:11:15 -0400 Subject: [PATCH] Added restart to rollback call --- trustify.py | 1 + trustify/client/CONFIG.py | 2 -- trustify/client/configurator.py | 14 +++----------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/trustify.py b/trustify.py index ec49e4550..d76aac87b 100644 --- a/trustify.py +++ b/trustify.py @@ -42,6 +42,7 @@ def main(): logger.setLogLevel(logger.INFO) config = configurator.Configurator() config.rollback_checkpoints(a) + config.restart() sys.exit(0) elif o == "--view-checkpoints": from trustify.client import configurator, logger diff --git a/trustify/client/CONFIG.py b/trustify/client/CONFIG.py index 16769350d..d8445886d 100644 --- a/trustify/client/CONFIG.py +++ b/trustify/client/CONFIG.py @@ -21,8 +21,6 @@ CHOC_CERT_CONF = CONFIG_DIR + "choc_cert_extensions.cnf" OPTIONS_SSL_CONF = CONFIG_DIR + "options-ssl.conf" # Temporary file for challenge virtual hosts APACHE_CHALLENGE_CONF = CONFIG_DIR + "choc_sni_cert_challenge.conf" -# Modified files intended to be reset (for challenges/tmp config changes) -ORPHAN_FILE = WORK_DIR + "orphans" # Byte size of S and Nonce S_SIZE = 32 diff --git a/trustify/client/configurator.py b/trustify/client/configurator.py index 4b500b876..81a7d3fa2 100644 --- a/trustify/client/configurator.py +++ b/trustify/client/configurator.py @@ -9,7 +9,7 @@ import time import shutil import errno -from trustify.client.CONFIG import SERVER_ROOT, BACKUP_DIR, ORPHAN_FILE +from trustify.client.CONFIG import SERVER_ROOT, BACKUP_DIR #from CONFIG import SERVER_ROOT, BACKUP_DIR, MODIFIED_FILES, REWRITE_HTTPS_ARGS, CONFIG_DIR, WORK_DIR from trustify.client.CONFIG import REWRITE_HTTPS_ARGS, CONFIG_DIR, WORK_DIR from trustify.client.CONFIG import TEMP_CHECKPOINT_DIR, IN_PROGRESS_DIR @@ -896,20 +896,12 @@ LogLevel warn \n\ def recovery_routine(self): """ - Revert all previously modified files. First, remove any potentially - orphaned files (those that did not make it to a checkpoint) - Then any changes found in + Revert all previously modified files. First, any changes found in TEMP_CHECKPOINT_DIR are removed, then IN_PROGRESS changes are removed The order is important. IN_PROGRESS is unable to add files that are already added by a TEMP change. Thus TEMP must be rolled back first because that will be the 'latest' occurance of the file. """ - # See if there were any orphaned files - # (Files that were created but never found their way into a checkpoint) - - if self.__remove_contained_files(ORPHAN_FILE): - self.aug.load() - self.revert_challenge_config() if os.path.isdir(IN_PROGRESS_DIR): result = self.__recover_checkpoint(IN_PROGRESS_DIR) @@ -1169,7 +1161,7 @@ LogLevel warn \n\ shutil.copy2(filename, cp_dir + os.path.basename(filename) + "_" + str(idx)) op_fd.write(filename + '\n') idx += 1 - of_fd.close() + op_fd.close() with open(cp_dir + "CHANGES_SINCE", 'a') as notes_fd: notes_fd.write(self.save_notes)