The directory processor is fully tested. The method for the running an execution of the exec files in the directory processor is implemented. The package processing is improved.

packages
Иванов Денис 4 years ago
parent c369e80439
commit a60ce2317a

@ -110,8 +110,10 @@ class BaseFormat():
выполняемого рекурсивно.''' выполняемого рекурсивно.'''
if template == OrderedDict(): if template == OrderedDict():
return return
if join_before: if join_before:
forwarded_items = OrderedDict() forwarded_items = OrderedDict()
for key_value in template: for key_value in template:
if key_value[0] == '!': if key_value[0] == '!':
# Удаление соответствующего элемента из original. # Удаление соответствующего элемента из original.
@ -131,6 +133,9 @@ class BaseFormat():
item_to_replace = ('',) + key_value[1:] item_to_replace = ('',) + key_value[1:]
elif isinstance(key_value, str): elif isinstance(key_value, str):
item_to_replace = key_value[1:] item_to_replace = key_value[1:]
else:
# Сюда надо вставить исключение.
pass
# Если соответствующего элемента нет в оригинале -- пропускаем. # Если соответствующего элемента нет в оригинале -- пропускаем.
if item_to_replace not in original.keys(): if item_to_replace not in original.keys():
@ -210,6 +215,9 @@ class BaseFormat():
self._join_before_in_areas) self._join_before_in_areas)
else: else:
if self._comments_processing: if self._comments_processing:
# Я пока еще не понял почему, но должно быть так:
if not original[key_value] and not template[key_value]:
continue
original[key_value][-1] = template[key_value][-1] original[key_value][-1] = template[key_value][-1]
else: else:
original[key_value] = template[key_value] original[key_value] = template[key_value]

@ -47,7 +47,8 @@ class ContentsFormat(BaseFormat):
if not self._initialized: if not self._initialized:
self._initialize_parser() self._initialize_parser()
if add_header and not ignore_comments and template_parser: if (add_header and not ignore_comments and template_parser
and template_path is not None):
self.header, document_text = self._get_header_and_document_text( self.header, document_text = self._get_header_and_document_text(
document_text, document_text,
template_path, template_path,

@ -513,6 +513,7 @@ class LDAPFormat(BaseFormat):
try: try:
parsing_result = self._comment_line.parseString(line) parsing_result = self._comment_line.parseString(line)
self._match = True self._match = True
print('comment is found')
if not self._ignore_comments: if not self._ignore_comments:
# До того, как первый элемент встречен -- все комментарии # До того, как первый элемент встречен -- все комментарии

@ -841,14 +841,13 @@ class CalculateExtension(Extension):
check_template.render(__datavars__=self._datavars) check_template.render(__datavars__=self._datavars)
elif (self.stream.current.type == 'name' elif (self.stream.current.type == 'name'
or self.stream.current.type == 'lparen'): or self.stream.current.type == 'lparen'
or self.stream.current.type == 'integer'):
# разбираем условие. Если условие False -- кидаем исключение. # разбираем условие. Если условие False -- кидаем исключение.
condition_result = self.get_condition_result() condition_result = self.get_condition_result()
if not condition_result: if not condition_result:
raise ConditionFailed( raise ConditionFailed('Condition is failed',
'Condition is failed', lineno=self.stream.current.lineno)
lineno=self.stream.current.lineno
)
else: else:
raise TemplateSyntaxError('Name is expected in calculate tag.', raise TemplateSyntaxError('Name is expected in calculate tag.',
lineno=self.stream.current.lineno) lineno=self.stream.current.lineno)

@ -337,11 +337,9 @@ class TemplateWrapper:
parameter_package = None parameter_package = None
if self.target_type is not None: if self.target_type is not None:
print('looking for package for file: {}'.format(self.target_path))
try: try:
file_package = self.package_atom_parser.get_file_package( file_package = self.package_atom_parser.get_file_package(
self.target_path) self.target_path)
print('package is found: {}'.format(file_package))
except PackageNotFound: except PackageNotFound:
file_package = None file_package = None
self.target_without_package = True self.target_without_package = True
@ -579,7 +577,6 @@ class TemplateWrapper:
def save_changes(self): def save_changes(self):
'''Метод для сохранения изменений внесенных в CONTENTS.''' '''Метод для сохранения изменений внесенных в CONTENTS.'''
if self.target_package: if self.target_package:
print('SAVING TO CONTENTS: {}'.format(self.target_package))
self.target_package.remove_empty_directories() self.target_package.remove_empty_directories()
self.target_package.write_contents_file() self.target_package.write_contents_file()
@ -1239,14 +1236,15 @@ class TemplateExecutor:
text_to_run = template_object.template_text text_to_run = template_object.template_text
interpreter = template_object.parameters.run interpreter = template_object.parameters.run
if not os.path.exists(template_object.target_path): if template_object.template_type == FILE:
cwd_path = os.path.dirname(template_object.target_path)
else:
cwd_path = template_object.target_path
if not os.path.exists(cwd_path):
raise TemplateExecutorError(("can not run template, directory from" raise TemplateExecutorError(("can not run template, directory from"
" target path does not exist: {}"). " target path does not exist: {}").
format(template_object.target_path)) format(template_object.target_path))
elif os.path.isdir(template_object.target_path):
cwd_path = template_object.target_path
else:
cwd_path = os.path.dirname(template_object.target_path)
try: try:
run_process = Process(interpreter, cwd=cwd_path) run_process = Process(interpreter, cwd=cwd_path)
@ -1274,15 +1272,18 @@ class TemplateExecutor:
text_to_run = template_object.template_text text_to_run = template_object.template_text
interpreter = template_object.parameters.exec interpreter = template_object.parameters.exec
if not os.path.exists(template_object.target_path): if template_object.template_type == FILE:
raise TemplateExecutorError(
("can not exec template, directory from"
" target path does not exist: {}").
format(template_object.target_path))
elif os.path.isdir(template_object.target_path):
cwd_path = template_object.target_path
else:
cwd_path = os.path.dirname(template_object.target_path) cwd_path = os.path.dirname(template_object.target_path)
else:
cwd_path = template_object.target_path
if not os.path.exists(cwd_path):
raise TemplateExecutorError(("can not run template, directory from"
" target path does not exist: {}").
format(template_object.target_path))
print('CWD_PATH = {}'.format(cwd_path))
print('TEMPLATE TEXT:')
print(text_to_run)
# Получаем путь к директории для хранения файлов .execute. # Получаем путь к директории для хранения файлов .execute.
if (self.chroot_path != '/' and not if (self.chroot_path != '/' and not
@ -1295,12 +1296,14 @@ class TemplateExecutor:
# exec по номеру последнего. # exec по номеру последнего.
exec_number = 0 exec_number = 0
if not self.execute_files: if not self.execute_files:
print('FROM DIR')
if os.path.exists(self.execute_archive_path): if os.path.exists(self.execute_archive_path):
exec_files_list = os.listdir(self.execute_archive_path) exec_files_list = os.listdir(self.execute_archive_path)
if exec_files_list: if exec_files_list:
exec_number = int(exec_files_list[-1][-4:]) exec_number = int(exec_files_list[-1][-4:])
exec_number = str(exec_number + 1) exec_number = str(exec_number + 1)
else: else:
print('FROM LIST')
exec_number = str(len(self.execute_files) + 1) exec_number = str(len(self.execute_files) + 1)
# Получаем название нового exec_???? файла. # Получаем название нового exec_???? файла.
@ -1309,15 +1312,18 @@ class TemplateExecutor:
exec_file_name = 'exec_{}'.format(exec_number) exec_file_name = 'exec_{}'.format(exec_number)
exec_file_path = join_paths(self.execute_archive_path, exec_file_path = join_paths(self.execute_archive_path,
exec_file_name) exec_file_name)
print('EXEC_FILE_PATH = {}\n'.format(exec_file_path))
exec_file = write_file(exec_file_path) exec_file = write_file(exec_file_path)
exec_file.write(text_to_run) exec_file.write(text_to_run)
exec_file.close() exec_file.close()
self.execute_files[exec_file_path] = {'interpreter': interpreter, self.execute_files[exec_file_path] = {'interpreter': interpreter,
'cwd_path': cwd_path} 'cwd_path': cwd_path,
'template_path':
template_object.template_path}
def execute_file(self, cwd_path, interpreter, exec_path): def execute_file(self, interpreter, exec_path, cwd_path):
"""Метод для выполнения скриптов сохраненных в результате обработки """Метод для выполнения скриптов сохраненных в результате обработки
шаблонов с параметром exec. Скрипт всегда удаляется вне зависимости шаблонов с параметром exec. Скрипт всегда удаляется вне зависимости
от успешности его выполнения.""" от успешности его выполнения."""
@ -1694,6 +1700,11 @@ class DirectoryProcessor:
# Режим заполнения очередей директорий пакетов, необходимых для более # Режим заполнения очередей директорий пакетов, необходимых для более
# быстрой обработки параметра merge. # быстрой обработки параметра merge.
self.fill_trees = bool(self.for_package) self.fill_trees = bool(self.for_package)
if self.for_package:
package = Package(self.for_package,
chroot_path=self.cl_chroot_path)
else:
package = None
for directory_path in self.template_paths: for directory_path in self.template_paths:
self.base_directory = directory_path.strip() self.base_directory = directory_path.strip()
@ -1704,7 +1715,8 @@ class DirectoryProcessor:
self._walk_directory_tree(node.path, self._walk_directory_tree(node.path,
self.cl_chroot_path, self.cl_chroot_path,
ParametersContainer(), ParametersContainer(),
directory_tree=self.directory_tree) directory_tree=self.directory_tree,
package=package)
# Теперь когда дерево заполнено, можно выключить этот режим. # Теперь когда дерево заполнено, можно выключить этот режим.
self.fill_trees = False self.fill_trees = False
@ -1714,6 +1726,9 @@ class DirectoryProcessor:
self.processed_packages.append(self.for_package) self.processed_packages.append(self.for_package)
self._merge_packages() self._merge_packages()
if self.template_executor.execute_files:
self._run_exec_files()
def _merge_packages(self): def _merge_packages(self):
'''Метод для выполнения шаблонов относящихся к пакетам, указанным во '''Метод для выполнения шаблонов относящихся к пакетам, указанным во
всех встреченных значениях параметра merge.''' всех встреченных значениях параметра merge.'''
@ -1730,6 +1745,9 @@ class DirectoryProcessor:
not_merged_packages.append(self.for_package) not_merged_packages.append(self.for_package)
continue continue
package = Package(self.for_package,
chroot_path=self.cl_chroot_path)
for directory_name in self.packages_file_trees[self.for_package]: for directory_name in self.packages_file_trees[self.for_package]:
directory_tree = self.packages_file_trees[self.for_package].\ directory_tree = self.packages_file_trees[self.for_package].\
get_directory_tree(directory_name) get_directory_tree(directory_name)
@ -1737,7 +1755,8 @@ class DirectoryProcessor:
self._walk_directory_tree(directory_tree.base_directory, self._walk_directory_tree(directory_tree.base_directory,
self.cl_chroot_path, self.cl_chroot_path,
ParametersContainer(), ParametersContainer(),
directory_tree=directory_tree) directory_tree=directory_tree,
package=package)
self.processed_packages.append(self.for_package) self.processed_packages.append(self.for_package)
@ -1747,6 +1766,29 @@ class DirectoryProcessor:
else: else:
self.output.set_success('All packages are merged...') self.output.set_success('All packages are merged...')
def _run_exec_files(self):
'''Метод для выполнения скриптов, полученных в результате обработки
шаблонов с параметром exec.'''
for exec_file_path, exec_info in\
self.template_executor.execute_files.items():
try:
output = self.template_executor.execute_file(
exec_info['interpreter'],
exec_file_path,
exec_info['cwd_path'])
if output['stdout'] is not None:
self.output.set_info("stdout from template: {}:\n{}\n".
format(exec_info['template_path'],
output['stdout']))
if output['stderr'] is not None:
self.output.set_error("stderr from template: {}:\n{}\n".
format(exec_info['template_path'],
output['stderr']))
except TemplateExecutorError as error:
self.output.set_error(str(error))
def _get_directories_queue(self, path): def _get_directories_queue(self, path):
'''Уже не актуальный метод для построение очередей из путей к '''Уже не актуальный метод для построение очередей из путей к
шаблонам. Хотя возможно еще пригодится.''' шаблонам. Хотя возможно еще пригодится.'''
@ -1765,7 +1807,8 @@ class DirectoryProcessor:
return base_directory, directories_queue return base_directory, directories_queue
def _walk_directory_tree(self, current_directory_path, current_target_path, def _walk_directory_tree(self, current_directory_path, current_target_path,
directory_parameters, directory_tree={}): directory_parameters, directory_tree={},
package=None):
'''Метод для рекурсивного обхода директорий с шаблонами, а также, при '''Метод для рекурсивного обхода директорий с шаблонами, а также, при
необходимости, заполнения деревьев директорий шаблонов, с помощью необходимости, заполнения деревьев директорий шаблонов, с помощью
которых далее выполняются шаблоны пакетов из merge.''' которых далее выполняются шаблоны пакетов из merge.'''
@ -1821,6 +1864,14 @@ class DirectoryProcessor:
if self.for_package and directory_parameters.merge: if self.for_package and directory_parameters.merge:
self.packages_to_merge.extend(directory_parameters.merge) self.packages_to_merge.extend(directory_parameters.merge)
# Если присутствует параметр package -- проверяем, изменился ли он
# и был ли задан до этого. Если не был задан или изменился, меняем
# текущий пакет ветки шаблонов на этот.
if directory_parameters.package:
if (package is None or
package.package_name != directory_parameters.package):
package = Package(directory_parameters.package,
chroot_path=self.cl_chroot_path)
else: else:
# Если .calculate_directory отсутствует -- создаем директорию, # Если .calculate_directory отсутствует -- создаем директорию,
# используя унаследованные параметры и имя самой директории. # используя унаследованные параметры и имя самой директории.
@ -1841,13 +1892,17 @@ class DirectoryProcessor:
# Для того чтобы директория была создана, просто добавляем параметр # Для того чтобы директория была создана, просто добавляем параметр
# append = join. # append = join.
directory_parameters.set_parameter({'append': 'join'}) directory_parameters.set_parameter({'append': 'join'})
template_text = ''
current_target_path = os.path.join(current_target_path, current_target_path = os.path.join(current_target_path,
directory_name) directory_name)
# Выполняем наложение шаблона. # Выполняем наложение шаблона.
current_target_path = self._execute_template(current_target_path, current_target_path = self._execute_template(
directory_parameters, DIR, current_target_path,
current_directory_path) directory_parameters, DIR,
current_directory_path,
template_text=template_text,
package=package)
if not current_target_path: if not current_target_path:
directory_tree = {} directory_tree = {}
return return
@ -1899,12 +1954,21 @@ class DirectoryProcessor:
template_name, template_name,
template_parameters) template_parameters)
# Создаем объект пакета для файлов шаблонов этой директории.
template_package = package
if template_parameters.package:
if (template_package is None or
package.package_name != directory_parameters.package):
template_package = Package(directory_parameters.package,
chroot_path=self.cl_chroot_path)
# Выполняем действия, указанные в шаблоне. # Выполняем действия, указанные в шаблоне.
target_file_path = self._execute_template( target_file_path = self._execute_template(
target_file_path, target_file_path,
template_parameters, template_parameters,
FILE, template_path, FILE, template_path,
template_text=template_text) template_text=template_text,
package=template_package)
if not target_file_path: if not target_file_path:
continue continue
@ -1924,7 +1988,8 @@ class DirectoryProcessor:
self._walk_directory_tree( self._walk_directory_tree(
directory, current_target_path, directory, current_target_path,
directory_parameters.get_inheritables(), directory_parameters.get_inheritables(),
directory_tree=directory_tree[directory_name]) directory_tree=directory_tree[directory_name],
package=package)
directory_tree[directory_name] = {} directory_tree[directory_name] = {}
else: else:
if isinstance(directory, DirectoryTree): if isinstance(directory, DirectoryTree):
@ -1937,7 +2002,8 @@ class DirectoryProcessor:
self._walk_directory_tree( self._walk_directory_tree(
directory_path, directory_path,
current_target_path, current_target_path,
directory_parameters.get_inheritables()) directory_parameters.get_inheritables(),
package=package)
if self.fill_trees: if self.fill_trees:
directory_tree = {} directory_tree = {}
@ -2044,7 +2110,8 @@ class DirectoryProcessor:
parameters, parameters,
template_type, template_type,
template_path, template_path,
template_text=''): template_text='',
package=None):
'''Метод для наложения шаблонов и обработки информации полученной после '''Метод для наложения шаблонов и обработки информации полученной после
наложения.''' наложения.'''
try: try:
@ -2053,7 +2120,8 @@ class DirectoryProcessor:
parameters, parameters,
template_type, template_type,
template_path, template_path,
template_text=template_text) template_text=template_text,
target_package=package)
# Если во время выполнения шаблона был изменен целевой путь, # Если во время выполнения шаблона был изменен целевой путь,
# например, из-за ссылки на директорию в source -- обновляем # например, из-за ссылки на директорию в source -- обновляем
# целевой путь. # целевой путь.

@ -620,6 +620,7 @@ class Package:
if contents_text: if contents_text:
contents_format = ContentsFormat(contents_text, contents_format = ContentsFormat(contents_text,
None,
template_parser=False) template_parser=False)
self.contents_dictionary = contents_format._document_dictionary self.contents_dictionary = contents_format._document_dictionary
return True return True
@ -635,7 +636,7 @@ class Package:
def render_contents_file(self): def render_contents_file(self):
'''Метод для получения текста файла CONTENTS.''' '''Метод для получения текста файла CONTENTS.'''
contents_format = ContentsFormat('', template_parser=False) contents_format = ContentsFormat('', None, template_parser=False)
contents_format._document_dictionary = self.contents_dictionary contents_format._document_dictionary = self.contents_dictionary
return contents_format.document_text return contents_format.document_text

@ -377,3 +377,133 @@ database bdb
result_text = result_file.read() result_text = result_file.read()
assert ldap_original_object.document_text == result_text assert ldap_original_object.document_text == result_text
def test_if_input_documents_are_an_original_document_without_calculate_header_and_a_template_and_the_add_header_flag_is_set__the_format_object_joins_an_original_document_and_a_template_and_adds_the_calculate_header(self):
original_text = '''
include /etc/openldap/schema/mail.schema
loglevel 0
allow bind_v2
modulepath /usr/lib/openldap/openldap
database bdb
checkpoint 1024 5
suffix "dc=calculate"
'''
template_text = '''
!include /etc/openldap/schema/mail.schema
database bdb
!suffix "dc=calculate"
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
loglevel 0
allow bind_v2
modulepath /usr/lib/openldap/openldap
database bdb
checkpoint 1024 5
'''
original_object = LDAPFormat(original_text, '/path/to/template',
add_header=True)
template_object = LDAPFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_if_input_documents_are_an_original_document_with_calculate_header_and_a_template_the_add_header_flag_is_set_and_the_already_changed_flag_is_not_set__the_format_object_removes_calculate_header_from_original_document__joins_an_original_document_and_a_template_and_adds_the_calculate_header(self):
original_text = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
#-------------------------------------------------------------------------------
include /etc/openldap/schema/mail.schema
loglevel 0
allow bind_v2
modulepath /usr/lib/openldap/openldap
database bdb
checkpoint 1024 5
suffix "dc=calculate"
'''
template_text = '''
!include /etc/openldap/schema/mail.schema
database bdb
!suffix "dc=calculate"
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
loglevel 0
allow bind_v2
modulepath /usr/lib/openldap/openldap
database bdb
checkpoint 1024 5
'''
original_object = LDAPFormat(original_text, '/path/to/template',
add_header=True)
template_object = LDAPFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_if_input_documents_are_an_original_document_with_calculate_header_and_a_template_the_add_header_flag_is_set_and_the_already_changed_flag_is_set__the_format_object_joins_an_original_document_and_a_template_and_adds_the_calculate_header_with_a_template_paths_from_the_old_header_and_paths_to_a_current_template(self):
original_text = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
#-------------------------------------------------------------------------------
include /etc/openldap/schema/mail.schema
loglevel 0
allow bind_v2
modulepath /usr/lib/openldap/openldap
database bdb
checkpoint 1024 5
suffix "dc=calculate"
'''
template_text = '''
!include /etc/openldap/schema/mail.schema
database bdb
!suffix "dc=calculate"
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
# /path/to/template
#-------------------------------------------------------------------------------
loglevel 0
allow bind_v2
modulepath /usr/lib/openldap/openldap
database bdb
checkpoint 1024 5
'''
original_object = LDAPFormat(original_text, '/path/to/template',
add_header=True, already_changed=True)
template_object = LDAPFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
print(original_object.document_text)
assert original_object.document_text == join_result

@ -201,3 +201,108 @@ rc_send_sighup="YES"
template = document_1_object.make_template(document_2_object) template = document_1_object.make_template(document_2_object)
document_1_object.join_template(template) document_1_object.join_template(template)
assert document_1_object.document_text == document_2 assert document_1_object.document_text == document_2
def test_if_input_documents_are_an_original_document_without_calculate_header_and_a_template_and_the_add_header_flag_is_set__the_format_object_joins_an_original_document_and_a_template_and_adds_the_calculate_header(self):
original_text = '''
# If you have multiple slapd instances per #376699, this will provide a default config
rc_interactive="NO"
INSTANCE="openldap${SVCNAME#slapd}"
# Comment1
# Comment2
OPTS_CONF="-f /etc/${INSTANCE}/slapd.conf"
'''
template_text = '''
!OPTS_CONF
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
# If you have multiple slapd instances per #376699, this will provide a default config
rc_interactive="NO"
instance="openldap${SVCNAME#slapd}"
'''
original_object = OpenRCFormat(original_text, '/path/to/template',
add_header=True)
template_object = OpenRCFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_if_input_documents_are_an_original_document_with_calculate_header_and_a_template_the_add_header_flag_is_set_and_the_already_changed_flag_is_not_set__the_format_object_removes_calculate_header_from_original_document__joins_an_original_document_and_a_template_and_adds_the_calculate_header(self):
original_text = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
#-------------------------------------------------------------------------------
# If you have multiple slapd instances per #376699, this will provide a default config
rc_interactive="NO"
INSTANCE="openldap${SVCNAME#slapd}"
# Comment1
# Comment2
OPTS_CONF="-f /etc/${INSTANCE}/slapd.conf"
'''
template_text = '''
!OPTS_CONF
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
# If you have multiple slapd instances per #376699, this will provide a default config
rc_interactive="NO"
instance="openldap${SVCNAME#slapd}"
'''
original_object = OpenRCFormat(original_text, '/path/to/template',
add_header=True)
template_object = OpenRCFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_if_input_documents_are_an_original_document_with_calculate_header_and_a_template_the_add_header_flag_is_set_and_the_already_changed_flag_is_set__the_format_object_joins_an_original_document_and_a_template_and_adds_the_calculate_header_with_a_template_paths_from_the_old_header_and_paths_to_a_current_template(self):
original_text = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
#-------------------------------------------------------------------------------
# If you have multiple slapd instances per #376699, this will provide a default config
rc_interactive="NO"
INSTANCE="openldap${SVCNAME#slapd}"
# Comment1
# Comment2
OPTS_CONF="-f /etc/${INSTANCE}/slapd.conf"
'''
template_text = '''
!OPTS_CONF
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
# /path/to/template
#-------------------------------------------------------------------------------
# If you have multiple slapd instances per #376699, this will provide a default config
rc_interactive="NO"
instance="openldap${SVCNAME#slapd}"
'''
original_object = OpenRCFormat(original_text, '/path/to/template',
add_header=True, already_changed=True)
template_object = OpenRCFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result

@ -181,3 +181,117 @@ mail_owner = postfix
template = document_1_object.make_template(document_2_object) template = document_1_object.make_template(document_2_object)
document_1_object.join_template(template) document_1_object.join_template(template)
assert document_1_object.document_text == document_2 assert document_1_object.document_text == document_2
def test_if_input_documents_are_an_original_document_without_calculate_header_and_a_template_and_the_add_header_flag_is_set__the_format_object_joins_an_original_document_and_a_template_and_adds_the_calculate_header(self):
original_text = '''
# Comment1
parameter_name = /home/divanov/Home
# Comment2
# Comment3
other_parameter = yes
smtp_tls_note_starttls_offer = yes
tls_random_source = dev:/dev/urandom
'''
template_text = '''
!other_parameter
!tls_random_source
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
# Comment1
parameter_name = /home/divanov/Home
smtp_tls_note_starttls_offer = yes
'''
original_object = PostfixFormat(original_text, '/path/to/template',
add_header=True)
template_object = PostfixFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_if_input_documents_are_an_original_document_with_calculate_header_and_a_template_the_add_header_flag_is_set_and_the_already_changed_flag_is_not_set__the_format_object_removes_calculate_header_from_original_document__joins_an_original_document_and_a_template_and_adds_the_calculate_header(self):
original_text = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
#-------------------------------------------------------------------------------
# Comment1
parameter_name = /home/divanov/Home
# Comment2
# Comment3
other_parameter = yes
smtp_tls_note_starttls_offer = yes
tls_random_source = dev:/dev/urandom
'''
template_text = '''
!other_parameter
!tls_random_source
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
# Comment1
parameter_name = /home/divanov/Home
smtp_tls_note_starttls_offer = yes
'''
original_object = PostfixFormat(original_text, '/path/to/template',
add_header=True)
template_object = PostfixFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_if_input_documents_are_an_original_document_with_calculate_header_and_a_template_the_add_header_flag_is_set_and_the_already_changed_flag_is_set__the_format_object_joins_an_original_document_and_a_template_and_adds_the_calculate_header_with_a_template_paths_from_the_old_header_and_paths_to_a_current_template(self):
original_text = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
#-------------------------------------------------------------------------------
# Comment1
parameter_name = /home/divanov/Home
# Comment2
# Comment3
other_parameter = yes
smtp_tls_note_starttls_offer = yes
tls_random_source = dev:/dev/urandom
'''
template_text = '''
!other_parameter
!tls_random_source
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
# /path/to/template
#-------------------------------------------------------------------------------
# Comment1
parameter_name = /home/divanov/Home
smtp_tls_note_starttls_offer = yes
'''
original_object = PostfixFormat(original_text, '/path/to/template',
add_header=True, already_changed=True)
template_object = PostfixFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result

@ -166,3 +166,96 @@ net.ipv4.icmp_echo_ignore_broadcasts=1
template = document_1_object.make_template(document_2_object) template = document_1_object.make_template(document_2_object)
document_1_object.join_template(template) document_1_object.join_template(template)
assert document_1_object.document_text == document_2 assert document_1_object.document_text == document_2
def test_if_input_documents_are_an_original_document_without_calculate_header_and_a_template_and_the_add_header_flag_is_set__the_format_object_joins_an_original_document_and_a_template_and_adds_the_calculate_header(self):
original_text = '''
net.ipv4.ip_forward = 0
parameter_name = /home/divanov/Home
other_parameter = yes
'''
template_text = '''
!parameter_name = /home/divanov/Home
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
net.ipv4.ip_forward=0
other_parameter=yes
'''
original_object = ProcmailFormat(original_text, '/path/to/template',
add_header=True)
template_object = ProcmailFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_if_input_documents_are_an_original_document_with_calculate_header_and_a_template_the_add_header_flag_is_set_and_the_already_changed_flag_is_not_set__the_format_object_removes_calculate_header_from_original_document__joins_an_original_document_and_a_template_and_adds_the_calculate_header(self):
original_text = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
#-------------------------------------------------------------------------------
net.ipv4.ip_forward = 0
parameter_name = /home/divanov/Home
other_parameter = yes
'''
template_text = '''
!parameter_name = /home/divanov/Home
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
net.ipv4.ip_forward=0
other_parameter=yes
'''
original_object = ProcmailFormat(original_text, '/path/to/template',
add_header=True)
template_object = ProcmailFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_if_input_documents_are_an_original_document_with_calculate_header_and_a_template_the_add_header_flag_is_set_and_the_already_changed_flag_is_set__the_format_object_joins_an_original_document_and_a_template_and_adds_the_calculate_header_with_a_template_paths_from_the_old_header_and_paths_to_a_current_template(self):
original_text = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
#-------------------------------------------------------------------------------
net.ipv4.ip_forward = 0
parameter_name = /home/divanov/Home
other_parameter = yes
'''
template_text = '''
!parameter_name = /home/divanov/Home
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
# /path/to/template
#-------------------------------------------------------------------------------
net.ipv4.ip_forward=0
other_parameter=yes
'''
original_object = ProcmailFormat(original_text, '/path/to/template',
add_header=True, already_changed=True)
template_object = ProcmailFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result

@ -1,6 +1,7 @@
import pytest import pytest
from collections import OrderedDict from collections import OrderedDict
from calculate.templates.format.proftpd_format import ProFTPDFormat from calculate.templates.format.proftpd_format import ProFTPDFormat
from pprint import pprint
@pytest.mark.proftpd @pytest.mark.proftpd
@ -239,3 +240,166 @@ class TestParsingMethods:
result_text = result_file.read() result_text = result_file.read()
assert proftpd_original_object.document_text == result_text assert proftpd_original_object.document_text == result_text
def test_if_input_documents_are_an_original_document_without_calculate_header_and_a_template_and_the_add_header_flag_is_set__the_format_object_joins_an_original_document_and_a_template_and_adds_the_calculate_header(self):
original_text = '''
ServerName "ProFTPD Anonymous Server"
ServerType standalone
<Anonymous ~ftp>
<Limit LOGIN>
DisplayLogin welcome.msg
DisplayFirstChdir .message
</Limit>
<Limit WRITE>
Order allow,deny
Allow from 10.0.0
Deny from all
</Limit>
</Anonymous>
'''
template_text = '''
!ServerType standalone
<Anonymous ~ftp>
<!Limit WRITE>
Order allow,deny
Allow from 10.0.0
Deny from all
</Limit>
</Anonymous>
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
ServerName "ProFTPD Anonymous Server"
<Anonymous ~ftp>
<Limit LOGIN>
DisplayLogin welcome.msg
DisplayFirstChdir .message
</Limit>
</Anonymous>
'''
original_object = ProFTPDFormat(original_text, '/path/to/template',
add_header=True)
template_object = ProFTPDFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_if_input_documents_are_an_original_document_with_calculate_header_and_a_template_the_add_header_flag_is_set_and_the_already_changed_flag_is_not_set__the_format_object_removes_calculate_header_from_original_document__joins_an_original_document_and_a_template_and_adds_the_calculate_header(self):
original_text = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
#-------------------------------------------------------------------------------
ServerName "ProFTPD Anonymous Server"
ServerType standalone
<Anonymous ~ftp>
<Limit LOGIN>
DisplayLogin welcome.msg
DisplayFirstChdir .message
</Limit>
<Limit WRITE>
Order allow,deny
Allow from 10.0.0
Deny from all
</Limit>
</Anonymous>
'''
template_text = '''
!ServerType standalone
<Anonymous ~ftp>
<!Limit WRITE>
Order allow,deny
Allow from 10.0.0
Deny from all
</Limit>
</Anonymous>
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
ServerName "ProFTPD Anonymous Server"
<Anonymous ~ftp>
<Limit LOGIN>
DisplayLogin welcome.msg
DisplayFirstChdir .message
</Limit>
</Anonymous>
'''
original_object = ProFTPDFormat(original_text, '/path/to/template',
add_header=True)
template_object = ProFTPDFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_if_input_documents_are_an_original_document_with_calculate_header_and_a_template_the_add_header_flag_is_set_and_the_already_changed_flag_is_set__the_format_object_joins_an_original_document_and_a_template_and_adds_the_calculate_header_with_a_template_paths_from_the_old_header_and_paths_to_a_current_template(self):
original_text = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
#-------------------------------------------------------------------------------
ServerName "ProFTPD Anonymous Server"
ServerType standalone
<Anonymous ~ftp>
<Limit LOGIN>
DisplayLogin welcome.msg
DisplayFirstChdir .message
</Limit>
<Limit WRITE>
Order allow,deny
Allow from 10.0.0
Deny from all
</Limit>
</Anonymous>
'''
template_text = '''
!ServerType standalone
<Anonymous ~ftp>
<!Limit WRITE>
Order allow,deny
Allow from 10.0.0
Deny from all
</Limit>
</Anonymous>
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
# /path/to/template
#-------------------------------------------------------------------------------
ServerName "ProFTPD Anonymous Server"
<Anonymous ~ftp>
<Limit LOGIN>
DisplayLogin welcome.msg
DisplayFirstChdir .message
</Limit>
</Anonymous>
'''
original_object = ProFTPDFormat(original_text, '/path/to/template',
add_header=True, already_changed=True)
print('ORIGINAL')
pprint(original_object._document_dictionary)
template_object = ProFTPDFormat(template_text, '/path/to/template')
print('TEMPLATE')
pprint(template_object._document_dictionary)
original_object.join_template(template_object)
assert original_object.document_text == join_result

@ -85,3 +85,165 @@ Another line of endless sadness.
patch_original.join_template(patch_template) patch_original.join_template(patch_template)
assert patch_original.document_text == output_text assert patch_original.document_text == output_text
def test_if_input_documents_are_an_original_document_without_calculate_header_and_a_template_and_the_add_header_flag_is_set__the_format_object_joins_an_original_document_and_a_template_and_adds_the_calculate_header(self):
parameters = ParametersContainer({'multiline': True, 'dotall': True})
original_text = '''[homes]
comment = Home Directories
browseable = no
writable = yes
# Un-comment the following and create the netlogon directory for Domain Logons
[netlogon]
comment = Network Logon Service
path = /var/lib/samba/netlogon
guest ok = yes
writable = no
share modes = no
'''
template_text = r'''
<reg dotall="1" multiline="0">(\[netlogon\].*)writable\s*=\s*[a-zA-Z_][a-zA-Z_0-9]*</reg>
<text>\1writable = yes</text>
<reg multiline="false" dotall="True">(\[homes\].*)browseable\s*=\s*[a-zA-Z_][a-zA-Z_0-9]*</reg>
<text>\1browseable = who knows</text>
<reg>(\[netlogon\].*)^\s*guest ok\s*=\s*[a-zA-Z_][a-zA-Z_0-9]*\n</reg>
<text>\1</text>
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
[homes]
comment = Home Directories
browseable = who knows
writable = yes
# Un-comment the following and create the netlogon directory for Domain Logons
[netlogon]
comment = Network Logon Service
path = /var/lib/samba/netlogon
writable = yes
share modes = no
'''
original_object = RegexFormat(original_text, '/path/to/template',
add_header=True, parameters=parameters)
template_object = RegexFormat(template_text, '/path/to/template',
parameters=parameters)
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_if_input_documents_are_an_original_document_with_calculate_header_and_a_template_the_add_header_flag_is_set_and_the_already_changed_flag_is_not_set__the_format_object_removes_calculate_header_from_original_document__joins_an_original_document_and_a_template_and_adds_the_calculate_header(self):
parameters = ParametersContainer({'multiline': True, 'dotall': True})
original_text = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
#-------------------------------------------------------------------------------
[homes]
comment = Home Directories
browseable = no
writable = yes
# Un-comment the following and create the netlogon directory for Domain Logons
[netlogon]
comment = Network Logon Service
path = /var/lib/samba/netlogon
guest ok = yes
writable = no
share modes = no
'''
template_text = r'''
<reg dotall="1" multiline="0">(\[netlogon\].*)writable\s*=\s*[a-zA-Z_][a-zA-Z_0-9]*</reg>
<text>\1writable = yes</text>
<reg multiline="false" dotall="True">(\[homes\].*)browseable\s*=\s*[a-zA-Z_][a-zA-Z_0-9]*</reg>
<text>\1browseable = who knows</text>
<reg>(\[netlogon\].*)^\s*guest ok\s*=\s*[a-zA-Z_][a-zA-Z_0-9]*\n</reg>
<text>\1</text>
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
[homes]
comment = Home Directories
browseable = who knows
writable = yes
# Un-comment the following and create the netlogon directory for Domain Logons
[netlogon]
comment = Network Logon Service
path = /var/lib/samba/netlogon
writable = yes
share modes = no
'''
original_object = RegexFormat(original_text, '/path/to/template',
add_header=True, parameters=parameters)
template_object = RegexFormat(template_text, '/path/to/template',
parameters=parameters)
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_if_input_documents_are_an_original_document_with_calculate_header_and_a_template_the_add_header_flag_is_set_and_the_already_changed_flag_is_set__the_format_object_joins_an_original_document_and_a_template_and_adds_the_calculate_header_with_a_template_paths_from_the_old_header_and_paths_to_a_current_template(self):
parameters = ParametersContainer({'multiline': True, 'dotall': True})
original_text = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
#-------------------------------------------------------------------------------
[homes]
comment = Home Directories
browseable = no
writable = yes
# Un-comment the following and create the netlogon directory for Domain Logons
[netlogon]
comment = Network Logon Service
path = /var/lib/samba/netlogon
guest ok = yes
writable = no
share modes = no
'''
template_text = r'''
<reg dotall="1" multiline="0">(\[netlogon\].*)writable\s*=\s*[a-zA-Z_][a-zA-Z_0-9]*</reg>
<text>\1writable = yes</text>
<reg multiline="false" dotall="True">(\[homes\].*)browseable\s*=\s*[a-zA-Z_][a-zA-Z_0-9]*</reg>
<text>\1browseable = who knows</text>
<reg>(\[netlogon\].*)^\s*guest ok\s*=\s*[a-zA-Z_][a-zA-Z_0-9]*\n</reg>
<text>\1</text>
'''
join_result = '''#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/ancient/template
# /path/to/template
#-------------------------------------------------------------------------------
[homes]
comment = Home Directories
browseable = who knows
writable = yes
# Un-comment the following and create the netlogon directory for Domain Logons
[netlogon]
comment = Network Logon Service
path = /var/lib/samba/netlogon
writable = yes
share modes = no
'''
original_object = RegexFormat(original_text, '/path/to/template',
add_header=True, already_changed=True,
parameters=parameters)
template_object = RegexFormat(template_text, '/path/to/template',
parameters=parameters)
original_object.join_template(template_object)
assert original_object.document_text == join_result

@ -740,22 +740,122 @@ class TestDirectoryProcessor:
assert os.path.exists(join_paths(CHROOT_PATH, '/etc/file_9')) assert os.path.exists(join_paths(CHROOT_PATH, '/etc/file_9'))
assert '/etc/file_9' in test_package assert '/etc/file_9' in test_package
def test_view_tree(self): def test_if_templates_consist_only_one_directory_with_a_calculate_directory_file_a_single_template_file_with_condition_and_condition_is_true__the_directory_processor_creates_new_file_and_adds_one_in_the_CONTENTS_file(self):
list_path = join_paths(CHROOT_PATH, '/etc') datavars.main['cl_template_path'] = os.path.join(CHROOT_PATH,
show_tree(list_path) 'templates_24')
assert False directory_processor = DirectoryProcessor('install',
datavars_module=datavars)
directory_processor.process_template_directories()
test_package = Package(test_package_name, chroot_path=CHROOT_PATH)
assert os.path.exists(join_paths(CHROOT_PATH, '/etc/file_10'))
assert '/etc/file_10' in test_package
def test_if_templates_consist_only_one_directory_with_a_calculate_directory_file_a_single_template_file_with_condition_and_condition_is_false__the_directory_processor_does_nothing(self):
datavars.main['cl_template_path'] = os.path.join(CHROOT_PATH,
'templates_25')
directory_processor = DirectoryProcessor('install',
datavars_module=datavars)
directory_processor.process_template_directories()
test_package = Package(test_package_name, chroot_path=CHROOT_PATH)
assert not os.path.exists(join_paths(CHROOT_PATH, '/etc/file_11'))
assert '/etc/file_11' not in test_package
def test_if_templates_consist_only_one_directory_with_a_calculate_directory_file_with_a_single_directory_that_contains_calculate_directory_file_with_condition_that_is_true_and_a_single_template_file__the_directory_processor_creates_new_directory_and_file_and_adds_one_in_the_CONTENTS_file(self):
datavars.main['cl_template_path'] = os.path.join(CHROOT_PATH,
'templates_26')
directory_processor = DirectoryProcessor('install',
datavars_module=datavars)
directory_processor.process_template_directories()
test_package = Package(test_package_name, chroot_path=CHROOT_PATH)
assert os.path.exists(join_paths(CHROOT_PATH, '/etc/dir_29'))
assert os.path.exists(join_paths(CHROOT_PATH, '/etc/dir_29/file_0'))
assert '/etc/dir_29' in test_package
assert '/etc/dir_29/file_0' in test_package
def test_if_templates_consist_only_one_directory_with_a_calculate_directory_file_with_a_single_directory_that_contains_calculate_directory_file_with_condition_that_is_false_and_a_single_template_file__the_directory_processor_creates_new_directory_and_file_and_adds_one_in_the_CONTENTS_file(self):
datavars.main['cl_template_path'] = os.path.join(CHROOT_PATH,
'templates_27')
directory_processor = DirectoryProcessor('install',
datavars_module=datavars)
directory_processor.process_template_directories()
test_package = Package(test_package_name, chroot_path=CHROOT_PATH)
def test_conditions(self): assert not os.path.exists(join_paths(CHROOT_PATH,
pass '/etc/dir_30'))
assert not os.path.exists(join_paths(CHROOT_PATH,
'/etc/dir_30/file_0'))
assert '/etc/dir_30' not in test_package
assert '/etc/dir_30/file_0' not in test_package
def test_if_templates_contain_a_template_file_with_a_target_path_to_a_file_with_some_cfg_files_and_changes_in_the_template_is_the_same_as_in_the_last_cfg_file__the_directory_processor_does_nothing(self):
datavars.main['cl_template_path'] = os.path.join(CHROOT_PATH,
'templates_28')
cfg_path_2 = os.path.join(CHROOT_PATH, 'etc/._cfg0002_file_12')
cfg_path_3 = os.path.join(CHROOT_PATH, 'etc/._cfg0003_file_12')
directory_processor = DirectoryProcessor('install',
datavars_module=datavars)
directory_processor.process_template_directories()
assert os.path.exists(join_paths(CHROOT_PATH, 'etc/file_12'))
assert os.path.exists(cfg_path_2)
assert not os.path.exists(cfg_path_3)
assert '/etc/file_12'\
in directory_processor.template_executor.calculate_config_file
def test_if_templates_contain_a_template_file_with_the_run_parameter_and_a_correct_script___the_directory_processor_runs_the_script_using_the_interpreter_from_the_run_parameter(self):
datavars.main['cl_template_path'] = os.path.join(CHROOT_PATH,
'templates_29')
directory_processor = DirectoryProcessor('install',
datavars_module=datavars)
directory_processor.process_template_directories()
def test_config_file(self): # Скрипт создает файл.
pass assert os.path.exists(join_paths(CHROOT_PATH, 'etc/file_13'))
def test_run(self): def test_if_templates_contain_a_directory_with_a_calculate_directory_file_with_the_run_parameter_and_a_correct_script___the_directory_processor_runs_the_script_using_the_interpreter_from_the_run_parameter(self):
pass datavars.main['cl_template_path'] = os.path.join(CHROOT_PATH,
'templates_30')
directory_processor = DirectoryProcessor('install',
datavars_module=datavars)
directory_processor.process_template_directories()
# Скрипт создает файл.
assert os.path.exists(join_paths(CHROOT_PATH, 'etc/file_14'))
def test_if_templates_contain_some_files_with_the_exec_parameter_and_a_correct_scripts___the_directory_processor_saves_all_the_scripts_in_the_special_execute_directory_and_runs_all_the_files_after_all_templates_are_joined_and_packages_from_the_merge_parameter_is_processed(self):
datavars.main['cl_template_path'] = os.path.join(CHROOT_PATH,
'templates_31')
directory_processor = DirectoryProcessor('install',
datavars_module=datavars)
directory_processor.process_template_directories()
assert os.path.exists(join_paths(CHROOT_PATH, 'etc/dir_31'))
assert os.path.exists(join_paths(CHROOT_PATH, 'etc/dir_31/file_0'))
assert os.path.exists(join_paths(CHROOT_PATH, 'etc/file_17'))
assert os.path.exists(join_paths(CHROOT_PATH, 'etc/file_15'))
with open(join_paths(CHROOT_PATH, '/etc/file_15'), 'r') as file_15:
file_text = file_15.read()
assert file_text == 'There is a strange type = static'
def test_exec(self): assert os.path.exists(join_paths(CHROOT_PATH, 'etc/file_16'))
pass with open(join_paths(CHROOT_PATH, '/etc/file_16'), 'r') as file_16:
file_text = file_16.read()
assert file_text == 'There is a value = 128'
def test_view_tree(self):
list_path = join_paths(CHROOT_PATH, '/etc')
show_tree(list_path)
assert True
def test_for_removing_testfile(self): def test_for_removing_testfile(self):
shutil.rmtree(os.path.join(CHROOT_PATH, 'etc')) shutil.rmtree(os.path.join(CHROOT_PATH, 'etc'))

@ -2479,7 +2479,7 @@ class TestTemplateExecutor:
def test_if_the_execute_template_method_s_input_is_a_template_with_the_run_parameter_and_a_target_path_to_an_existing_directory_and_its_text_is_correct__the_method_runs_a_template_text_in_the_target_directory_and_returns_the_object_with_its_stdout(self): def test_if_the_execute_template_method_s_input_is_a_template_with_the_run_parameter_and_a_target_path_to_an_existing_directory_and_its_text_is_correct__the_method_runs_a_template_text_in_the_target_directory_and_returns_the_object_with_its_stdout(self):
target_path = join_paths( target_path = join_paths(
CHROOT_PATH, CHROOT_PATH,
'/etc/run_parameter_testfiles/dir_0') '/etc/run_parameter_testfiles/dir_0/file_0')
parameters_object = ParametersContainer({'package': test_package_name, parameters_object = ParametersContainer({'package': test_package_name,
'run': '/usr/bin/python'}) 'run': '/usr/bin/python'})
template_text = ''' template_text = '''
@ -2495,10 +2495,10 @@ print(os.getcwd())'''
assert output['stdout'].strip() == target_path assert output['stdout'].strip() == target_path
assert output['stderr'] is None assert output['stderr'] is None
def test_if_the_execute_template_method_s_input_is_a_template_with_the_run_parameter_and_a_target_path_to_an_unexisting_directory__the_method_throws_TemplateExecutorError_exception(self): def test_if_the_execute_template_method_s_input_is_a_template_with_the_run_parameter_and_a_directory_from_a_target_path_does_not_exist__the_method_throws_TemplateExecutorError_exception(self):
target_path = join_paths( target_path = join_paths(
CHROOT_PATH, CHROOT_PATH,
'/etc/run_parameter_testfiles/dir_1') '/etc/run_parameter_testfiles/dir_1/file_0')
parameters_object = ParametersContainer({'package': test_package_name, parameters_object = ParametersContainer({'package': test_package_name,
'run': '/usr/bin/python'}) 'run': '/usr/bin/python'})
with pytest.raises(TemplateExecutorError): with pytest.raises(TemplateExecutorError):
@ -2754,9 +2754,9 @@ print(os.getcwd())'''
counter = 1 counter = 1
for exec_file_path in template_executor.execute_files: for exec_file_path in template_executor.execute_files:
output = template_executor.execute_file( output = template_executor.execute_file(
template_executor.execute_files[exec_file_path]['cwd_path'],
template_executor.execute_files[exec_file_path]['interpreter'], template_executor.execute_files[exec_file_path]['interpreter'],
exec_file_path) exec_file_path,
template_executor.execute_files[exec_file_path]['cwd_path'] )
assert output['stdout'].strip() == str(counter) assert output['stdout'].strip() == str(counter)
assert output['stderr'] is None assert output['stderr'] is None
counter += 1 counter += 1
@ -2787,9 +2787,9 @@ AttributeError: module 'os' has no attribute 'suspicious_attribute'
counter = 1 counter = 1
for exec_file_path in template_executor.execute_files: for exec_file_path in template_executor.execute_files:
output = template_executor.execute_file( output = template_executor.execute_file(
template_executor.execute_files[exec_file_path]['cwd_path'],
template_executor.execute_files[exec_file_path]['interpreter'], template_executor.execute_files[exec_file_path]['interpreter'],
exec_file_path) exec_file_path,
template_executor.execute_files[exec_file_path]['cwd_path'])
assert output['stdout'] is None assert output['stdout'] is None
assert output['stderr'] == stderr_text assert output['stderr'] == stderr_text
counter += 1 counter += 1

@ -34,6 +34,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -59,6 +60,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/none'), '/etc/dir/none'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
assert template_wrapper.target_type is None assert template_wrapper.target_type is None
@ -72,6 +74,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/dir_2'), '/etc/dir/dir_2'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
assert template_wrapper.target_type == DIR assert template_wrapper.target_type == DIR
@ -86,6 +89,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
assert template_wrapper.target_type == FILE assert template_wrapper.target_type == FILE
@ -103,6 +107,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
assert template_wrapper.target_type == FILE assert template_wrapper.target_type == FILE
@ -118,6 +123,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/dir_2'), '/etc/dir/dir_2'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -130,6 +136,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file_link'), '/etc/file_link'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -143,6 +150,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/dir_2'), '/etc/dir/dir_2'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -160,6 +168,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_link'), '/etc/dir_link'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -177,6 +186,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file_link'), '/etc/file_link'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
assert template_wrapper.target_path_is_changed assert template_wrapper.target_path_is_changed
@ -192,6 +202,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/dir_2'), '/etc/dir/dir_2'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
assert template_wrapper.target_type == DIR assert template_wrapper.target_type == DIR
@ -206,6 +217,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_link'), '/etc/dir_link'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
assert template_wrapper.target_path_is_changed assert template_wrapper.target_path_is_changed
@ -222,6 +234,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -234,6 +247,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file_link'), '/etc/file_link'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -246,6 +260,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -262,6 +277,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file_link'), '/etc/file_link'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -278,6 +294,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_link'), '/etc/dir_link'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -294,6 +311,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file_link'), '/etc/file_link'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -309,6 +327,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_link'), '/etc/dir_link'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -320,6 +339,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file_link'), '/etc/file_link'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -331,6 +351,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_link'), '/etc/dir_link'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -346,6 +367,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -357,6 +379,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/dir_2'), '/etc/dir/dir_2'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -368,6 +391,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -379,6 +403,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/dir_2'), '/etc/dir/dir_2'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -391,6 +416,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -407,6 +433,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/dir_2'), '/etc/dir/dir_2'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -423,6 +450,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -439,6 +467,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/dir_2'), '/etc/dir/dir_2'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -455,6 +484,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file'), '/etc/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -467,6 +497,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file'), '/etc/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -482,6 +513,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -499,6 +531,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -515,6 +548,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/other_file.conf'), '/etc/other_file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -526,6 +560,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -543,6 +578,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_0/file'), '/etc/dir_0/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -558,6 +594,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_1/file'), '/etc/dir_1/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -575,6 +612,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_2/file'), '/etc/dir_2/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -593,6 +631,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -611,6 +650,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -625,6 +665,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/not_protected/file.conf'), '/not_protected/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -639,6 +680,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/terminfo/info.json'), '/etc/terminfo/info.json'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -654,6 +696,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/not_protected/file.conf'), '/not_protected/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -669,6 +712,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_0/file'), '/etc/dir_0/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -684,6 +728,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/none'), '/etc/dir/none'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -699,6 +744,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/deleted.json'), '/etc/dir/deleted.json'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -714,6 +760,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file'), '/etc/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -729,6 +776,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_0/file'), '/etc/dir_0/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -745,6 +793,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file'), '/etc/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -761,6 +810,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -775,6 +825,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_0/file'), '/etc/dir_0/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -792,6 +843,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -809,6 +861,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_0/file'), '/etc/dir_0/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -830,6 +883,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -848,6 +902,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir_0/file'), '/etc/dir_0/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
for protected_path in template_wrapper._protected_set: for protected_path in template_wrapper._protected_set:
@ -868,6 +923,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -884,6 +940,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir'), '/etc/dir'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -901,6 +958,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/'), '/etc/dir/'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -919,6 +977,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file'), '/etc/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -936,6 +995,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file'), '/etc/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -955,6 +1015,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -971,6 +1032,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir'), '/etc/dir'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -991,6 +1053,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir'), '/etc/dir'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -1018,6 +1081,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir'), '/etc/dir'),
parameters_object, DIR, parameters_object, DIR,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -1045,6 +1109,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file'), '/etc/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -1057,6 +1122,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -1069,6 +1135,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/file'), '/etc/file'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -1085,6 +1152,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -1105,6 +1173,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/dir_1/config.json'), '/etc/dir/dir_1/config.json'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -1140,6 +1209,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/none'), '/etc/dir/none'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
@ -1158,6 +1228,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -1173,6 +1244,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:
@ -1188,6 +1260,7 @@ class TestTemplateWrapper:
join_paths(CHROOT_PATH, join_paths(CHROOT_PATH,
'/etc/dir/file.conf'), '/etc/dir/file.conf'),
parameters_object, FILE, parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH, chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH) config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error: except Exception as error:

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
section-name {
parameter-1 yes;
parameter-2 no;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_28/root/file_12
#-------------------------------------------------------------------------------
section-name {
parameter-1 yes;
parameter-3 10;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
section-name {
parameter-1 yes;
parameter-2 no;
};

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_8/root/file_2
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_9/root/etc/file_3
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_28/root/file_12
#-------------------------------------------------------------------------------
section-name {
parameter-1 yes;
parameter-3 10;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_14/root/dir_10/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_16/root/dir_12/file_0
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_17/root/dir_13/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_3/root/dir_2/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_5/root/dir_4/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_5/root/dir_5/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_7/root/dir_6/file_0
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_10/root/etc/dir_7/file_0
#-------------------------------------------------------------------------------
options {
parameter-0 no;
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_14/root/dir_9/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_1/root/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_6/root/file_1
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_10/root/etc/file_4
#-------------------------------------------------------------------------------
options {
parameter-0 no;
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_10/root/etc/file_5
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_12/root_0/etc/file_6
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_13/root/etc/dir_9/file_8
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,66 @@
root::0:root
bin::1:root,bin,daemon
daemon::2:root,bin,daemon
sys::3:root,bin,adm
adm::4:root,adm,daemon
tty::5:
disk::6:root,adm,haldaemon
lp::7:lp,guest
mem::8:
kmem::9:
wheel::10:root,guest
floppy::11:root,haldaemon
mail::12:mail
news::13:news
uucp::14:uucp,guest
man::15:man
console::17:
audio::18:guest
cdrom::19:haldaemon,guest
dialout::20:root
tape::26:root
video::27:root,guest
cdrw::80:haldaemon,guest
usb::85:haldaemon,guest
users::100:games,guest
nofiles:x:200:
smmsp:x:209:smmsp
portage::250:portage
utmp:x:406:
nogroup::65533:
nobody::65534:
sshd:x:22:
games:x:35:guest
plugdev:x:440:haldaemon,usbmux,guest
scanner:x:441:guest
ldap:x:439:
messagebus:x:199:
lpadmin:x:106:
polkituser:x:105:
cron:x:16:
ntp:x:123:
rpc:x:111:
fingerprint:x:104:
ssmtp:x:103:
crontab:x:102:
gdm:x:101:
haldaemon:x:999:haldaemon
openvpn:x:998:
vnstat:x:997:
dnsmasq:x:996:
polkitd:x:995:
locate:x:994:
input:x:993:
dhcp:x:992:
mysql:x:60:
netdev:x:991:
avahi:x:990:
avahi-autoipd:x:989:
nm-openvpn:x:988:
deluge:x:987:
postgres:x:70:
nullmail:x:88:
sudo:x:443:
kvm:x:78:
render:x:28:
guest:!:1000:

@ -0,0 +1,42 @@
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/false
daemon:x:2:2:daemon:/sbin:/bin/false
adm:x:3:4:adm:/var/adm:/bin/false
lp:x:4:7:lp:/var/spool/lpd:/bin/false
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:Mail program user:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/usr/lib/news:/bin/false
uucp:x:10:14:uucp:/var/spool/uucppublic:/bin/false
operator:x:11:0:operator:/root:/bin/bash
man:x:13:15:man:/usr/share/man:/bin/false
postmaster:x:14:12:Postmaster user:/var/spool/mail:/sbin/nologin
portage:x:250:250:portage:/var/tmp/portage:/bin/false
nobody:x:65534:65534:nobody:/:/bin/false
sshd:x:22:22:added by portage for openssh:/var/empty:/sbin/nologin
ldap:x:439:439:added by portage for openldap:/usr/lib64/openldap:/sbin/nologin
messagebus:x:101:199:System user; messagebus:/dev/null:/sbin/nologin
polkituser:x:102:105:added by portage for polkit:/dev/null:/sbin/nologin
cron:x:16:16:added by portage for cronbase:/var/spool/cron:/sbin/nologin
ntp:x:123:123:added by portage for ntp:/dev/null:/sbin/nologin
rpc:x:111:111:added by portage for portmap:/dev/null:/sbin/nologin
gdm:x:103:101:added by portage for gdm:/var/lib/gdm:/sbin/nologin
haldaemon:x:104:999:added by portage for hal:/dev/null:/sbin/nologin
openvpn:x:105:998:added by portage for openvpn:/dev/null:/sbin/nologin
usbmux:x:106:85:added by portage for usbmuxd:/dev/null:/sbin/nologin
vnstat:x:107:997:added by portage for vnstat:/dev/null:/sbin/nologin
dnsmasq:x:108:996:added by portage for dnsmasq:/dev/null:/sbin/nologin
polkitd:x:109:995:added by portage for polkit:/var/lib/polkit-1:/sbin/nologin
saned:x:110:441:added by portage for sane-backends:/dev/null:/sbin/nologin
dhcp:x:112:992:added by portage for dhcp:/var/lib/dhcp:/sbin/nologin
mysql:x:60:60:added by portage for mysql:/dev/null:/sbin/nologin
avahi:x:113:990:added by portage for avahi:/dev/null:/sbin/nologin
avahi-autoipd:x:114:989:added by portage for avahi:/dev/null:/sbin/nologin
nm-openvpn:x:115:988:added by portage for networkmanager-openvpn:/dev/null:/sbin/nologin
games:x:36:35:added by portage for games-envd:/usr/games:/bin/bash
deluge:x:116:987:added by portage for deluge:/var/lib/deluge:/sbin/nologin
postgres:x:70:70:added by portage for postgresql:/var/lib/postgresql:/bin/sh
nullmail:x:88:88:added by portage for nullmailer:/var/nullmailer:/sbin/nologin
divanov:x:1427:1000::/home/denis:/bin/bash
guest:x:1000:1000::/home/guest:/bin/bash

@ -0,0 +1 @@
{% calculate append = 'skip', action = 'install', package = 'test-category/test-package' %}

@ -0,0 +1,6 @@
{% calculate append = 'join', format = 'bind', path = '/etc' -%}
{% calculate install.number > 100 -%}
options {
parameter-1 {{ variables.variable_1 }};
parameter-2 {{ variables.variable_2 }};
};

@ -0,0 +1 @@
{% calculate append = 'skip', action = 'install', package = 'test-category/test-package' %}

@ -0,0 +1,6 @@
{% calculate append = 'join', format = 'bind', path = '/etc' -%}
{% calculate install.number < 100 -%}
options {
parameter-1 {{ variables.variable_1 }};
parameter-2 {{ variables.variable_2 }};
};

@ -0,0 +1,2 @@
{% calculate append = 'skip', action = 'install', package = 'test-category/test-package' %}
{% calculate path = '/etc' %}

@ -0,0 +1,5 @@
{% calculate append = 'join', format = 'bind' -%}
options {
parameter-1 {{ variables.variable_1 }};
parameter-2 {{ variables.variable_2 }};
};

@ -0,0 +1,2 @@
{% calculate append = 'skip', action = 'install', package = 'test-category/test-package' %}
{% calculate path = '/etc' %}

@ -0,0 +1 @@
{% calculate append = 'join', install.number in variables.group.list %}

@ -0,0 +1,5 @@
{% calculate append = 'join', format = 'bind' -%}
options {
parameter-1 {{ variables.variable_1 }};
parameter-2 {{ variables.variable_2 }};
};

@ -0,0 +1 @@
{% calculate append = 'skip', action = 'install', package = 'test-category/test-package' %}

@ -0,0 +1,2 @@
{% calculate append = 'join', format = 'bind', path = '/etc' -%}
section-name { parameter-3 10; }

@ -0,0 +1 @@
{% calculate append = 'skip', action = 'install', package = 'test-category/test-package' %}

@ -0,0 +1,4 @@
{% calculate path = '/etc', run = '/usr/bin/python' -%}
output_text = 'Sorry, you are not a winner'
with open('./file_13', 'w') as file_13:
file_13.write(output_text)

@ -0,0 +1 @@
{% calculate append = 'skip', action = 'install', package = 'test-category/test-package' %}

@ -0,0 +1,6 @@
{% calculate run = '/usr/bin/python' -%}
import os
output_text = 'Sorry, you are not a winner'
with open('./file_14', 'w') as file_14:
file_13.write(output_text)
print('File created on path: {}'.format(os.path.join(os.getcwd(), './file_14')))

@ -0,0 +1 @@
{% calculate append = 'skip', action = 'install', path = '/etc' %}

@ -0,0 +1 @@
{% calculate append = 'join', package = 'test-category/test-package' %}

@ -0,0 +1,5 @@
{% calculate append = 'join', format = 'bind', merge = 'test-category/new-package' -%}
options {
parameter-1 {{ variables.variable_1 }};
parameter-2 {{ variables.variable_2 }};
};

@ -0,0 +1,4 @@
{% calculate path = '/etc', exec = '/usr/bin/python' -%}
output_text = 'There is a strange type = {{ install.type }}'
with open('./file_15', 'w') as file_15:
file_15.write(output_text)

@ -0,0 +1,4 @@
{% calculate path = '/etc', exec = '/usr/bin/python' -%}
output_text = 'There is a value = {{ install.number }}'
with open('./file_16', 'w') as file_16:
file_16.write(output_text)

@ -0,0 +1,5 @@
{% calculate append = 'join', format = 'bind', package = 'test-category/new-package' -%}
options {
parameter-1 {{ variables.variable_1 }};
parameter-2 {{ variables.variable_2 }};
};

@ -3,3 +3,4 @@ dir /etc/dir_17
obj /etc/dir_17/file_0 c585be6f171462940b44af994a54040d 1593525253 obj /etc/dir_17/file_0 c585be6f171462940b44af994a54040d 1593525253
dir /etc/dir_17/dir_0 dir /etc/dir_17/dir_0
obj /etc/dir_17/dir_0/file_0 c585be6f171462940b44af994a54040d 1593525253 obj /etc/dir_17/dir_0/file_0 c585be6f171462940b44af994a54040d 1593525253
obj /etc/file_12 ee090b452dbf92d697124eb424f5de5b 1592574626

@ -0,0 +1,12 @@
dir /etc
obj /etc/file_1 823bb8dc6fdf14449714181a729374a9 1594219444
obj /etc/file_2 178094df387d2f5c2a3516a81fe760de 1594219445
obj /etc/file_3 ed2b41fe5b2e68ad3a974e0b8f9cc99a 1594219445
obj /etc/file_4 da04b7769f94c9702c0edcb8bba4770c 1594219445
dir /etc/dir_6
obj /etc/dir_6/file_0 e6977bce3e6edd818bb72f324a2a74f3 1594219444
obj /etc/dir_7/file_0 664c77aaf2d358d227db03545b083ea3 1594219446
dir /etc/dir_12
obj /etc/dir_12/file_0 a9109c66e7ec71c12bb2d45273f2c46d 1594219447
obj /etc/file_5 916eec267d08950072369b69c10a99ae 1594219445
dir /etc/dir_7

@ -0,0 +1,3 @@
dir /etc
dir /etc/dir_9
obj /etc/dir_9/file_0 78373bda3f7f86f54ca25724291a5492 1594219446

@ -0,0 +1,18 @@
dir /etc
dir /etc/dir_17
obj /etc/dir_17/file_0 c585be6f171462940b44af994a54040d 1593525253
dir /etc/dir_17/dir_0
obj /etc/dir_17/dir_0/file_0 c585be6f171462940b44af994a54040d 1593525253
obj /etc/file_12 ee090b452dbf92d697124eb424f5de5b 1592574626
obj /etc/file_0 d8047d1de0f84955782fb17d9172c283 1594219443
dir /etc/dir_2
obj /etc/dir_2/file_0 4d87707225fe92339257baad74d26220 1594219443
dir /etc/dir_4
obj /etc/dir_4/file_0 2760f4fa242d649cc32b7c27926b5bf9 1594219444
dir /etc/dir_5
dir /etc/dir_5/dir_6
obj /etc/dir_5/dir_6/file_0 c5f1a785f8e5f4af46c74afcb7c2efcc 1594219444
obj /etc/file_6 8ad8eb73b5f86ee77c2f4a89f61a5899 1594219446
obj /etc/file_8 ada08a4f77c8181fa33cac4aa39b2843 1594219446
dir /etc/dir_10
obj /etc/dir_10/file_0 454438a905c36213ec67d2a61b855daa 1594219447

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_14/root/dir_10/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_16/root/dir_12/file_0
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_3/root/dir_2/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_5/root/dir_4/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_5/root/dir_5/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_7/root/dir_6/file_0
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_10/root/etc/dir_7/file_0
#-------------------------------------------------------------------------------
options {
parameter-0 no;
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_14/root/dir_9/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_1/root/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_6/root/file_1
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_10/root/etc/file_4
#-------------------------------------------------------------------------------
options {
parameter-0 no;
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_10/root/etc/file_5
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_12/root_0/etc/file_6
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -0,0 +1,9 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_13/root/etc/dir_9/file_8
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};
Loading…
Cancel
Save