From 9afed63d58a5e7f8553ea09ba6c3aab14040b8ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=81?= Date: Tue, 24 Nov 2020 18:16:01 +0300 Subject: [PATCH] Fixed directories default append. fixed #27 --- calculate/templates/template_processor.py | 6 ++++-- tests/templates/test_directory_processor.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/calculate/templates/template_processor.py b/calculate/templates/template_processor.py index 05f1053..89f98b5 100644 --- a/calculate/templates/template_processor.py +++ b/calculate/templates/template_processor.py @@ -793,7 +793,7 @@ class TemplateExecutor: if template_object.parameters.mirror: if save_changes: template_object.save_changes() - return + return self.executor_output template_object.target_type = None @@ -2394,11 +2394,13 @@ class DirectoryProcessor: # используя унаследованные параметры и имя самой директории. # Для того чтобы директория была создана, просто добавляем параметр # append = join. - directory_parameters.set_parameter({'append': 'join'}) template_text = '' current_target_path = os.path.join(current_target_path, directory_name) + if not directory_parameters.append: + directory_parameters.set_parameter({'append': 'join'}) + # Выполняем наложение шаблона. current_target_path = self._execute_template( current_target_path, diff --git a/tests/templates/test_directory_processor.py b/tests/templates/test_directory_processor.py index 3abbcb1..d5a5be8 100644 --- a/tests/templates/test_directory_processor.py +++ b/tests/templates/test_directory_processor.py @@ -1190,6 +1190,8 @@ class TestDirectoryProcessor: '/etc/dir_39/file_0'): 'N', join_paths(CHROOT_PATH, '/etc/dir_41/file_0'): 'N', + join_paths(CHROOT_PATH, + '/etc/dir_43'): 'N', join_paths(CHROOT_PATH, '/etc/dir_43/file_0'): 'N', join_paths(CHROOT_PATH,