diff --git a/pkg/scheduler/patcher/main.py b/pkg/scheduler/patcher/main.py index 48424ea2e..0fd07283e 100644 --- a/pkg/scheduler/patcher/main.py +++ b/pkg/scheduler/patcher/main.py @@ -22,7 +22,7 @@ from filecmp import clear_cache, cmp from os import makedirs, remove from os.path import basename, dirname, isfile , join -from shutil import copy, move +from shutil import copy from signal import SIGINT, SIGTERM, signal import yaml @@ -160,8 +160,9 @@ def run(): if manifest.changed: manifest.backup() manifest.remove() + log.info('manifest file({}) was removed'.format(manifest.path)) manifest.flush() - log.info('manifest file({}) was patched'.format(manifest.copyPath)) + log.info('manifest file({}) was patched'.format(manifest.path)) first_try = False if first_try: @@ -227,7 +228,6 @@ def compile_config(self): class ManifestFile(File): def __init__(self, path, volumes, config_path, backup_folder, config_unschedulable_pods): self.path = path - self.copyPath = path + "_1" self.backup_folder = backup_folder self.volumes = volumes self.config_path = config_path @@ -238,14 +238,6 @@ def backup(self): backup_path = join(self.backup_folder,basename(self.path)) copy(self.path, backup_path) - def moveManifest(self): - move(self.path, self.copyPath) - log.info('{} moved to {}'.format(self.path, self.copyPath)) - - def restoreManifest(self): - move(self.copyPath, self.path) - log.info('{} restored from {}'.format(self.copyPath, self.path)) - def restore(self): backup_path = join(self.backup_folder,basename(self.path)) copy(backup_path, self.path) @@ -260,11 +252,6 @@ def load(self): log.debug('manifest {} loaded'.format(self.path)) self.changed = False - def flushMovedManifest(self): - with open(self.copyPath, 'w') as f: - yaml.dump(self.content, f) - log.debug('manifest {} dumped'.format(self.copyPath)) - def flush(self): with open(self.path, 'w') as f: yaml.dump(self.content, f)