Added restart to rollback call

This commit is contained in:
James Kasten
2013-05-23 22:11:15 -04:00
parent cbef46463d
commit 98e70df5e4
3 changed files with 4 additions and 13 deletions
+1
View File
@@ -42,6 +42,7 @@ def main():
logger.setLogLevel(logger.INFO) logger.setLogLevel(logger.INFO)
config = configurator.Configurator() config = configurator.Configurator()
config.rollback_checkpoints(a) config.rollback_checkpoints(a)
config.restart()
sys.exit(0) sys.exit(0)
elif o == "--view-checkpoints": elif o == "--view-checkpoints":
from trustify.client import configurator, logger from trustify.client import configurator, logger
-2
View File
@@ -21,8 +21,6 @@ CHOC_CERT_CONF = CONFIG_DIR + "choc_cert_extensions.cnf"
OPTIONS_SSL_CONF = CONFIG_DIR + "options-ssl.conf" OPTIONS_SSL_CONF = CONFIG_DIR + "options-ssl.conf"
# Temporary file for challenge virtual hosts # Temporary file for challenge virtual hosts
APACHE_CHALLENGE_CONF = CONFIG_DIR + "choc_sni_cert_challenge.conf" 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 # Byte size of S and Nonce
S_SIZE = 32 S_SIZE = 32
+3 -11
View File
@@ -9,7 +9,7 @@ import time
import shutil import shutil
import errno 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 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 REWRITE_HTTPS_ARGS, CONFIG_DIR, WORK_DIR
from trustify.client.CONFIG import TEMP_CHECKPOINT_DIR, IN_PROGRESS_DIR from trustify.client.CONFIG import TEMP_CHECKPOINT_DIR, IN_PROGRESS_DIR
@@ -896,20 +896,12 @@ LogLevel warn \n\
def recovery_routine(self): def recovery_routine(self):
""" """
Revert all previously modified files. First, remove any potentially Revert all previously modified files. First, any changes found in
orphaned files (those that did not make it to a checkpoint)
Then any changes found in
TEMP_CHECKPOINT_DIR are removed, then IN_PROGRESS changes are removed TEMP_CHECKPOINT_DIR are removed, then IN_PROGRESS changes are removed
The order is important. IN_PROGRESS is unable to add files that are 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 already added by a TEMP change. Thus TEMP must be rolled back first
because that will be the 'latest' occurance of the file. 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() self.revert_challenge_config()
if os.path.isdir(IN_PROGRESS_DIR): if os.path.isdir(IN_PROGRESS_DIR):
result = self.__recover_checkpoint(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)) shutil.copy2(filename, cp_dir + os.path.basename(filename) + "_" + str(idx))
op_fd.write(filename + '\n') op_fd.write(filename + '\n')
idx += 1 idx += 1
of_fd.close() op_fd.close()
with open(cp_dir + "CHANGES_SINCE", 'a') as notes_fd: with open(cp_dir + "CHANGES_SINCE", 'a') as notes_fd:
notes_fd.write(self.save_notes) notes_fd.write(self.save_notes)