|
|
@ -27,11 +27,10 @@ EXECUTE_ARCHIVE_PATH = os.path.join(CHROOT_PATH,
|
|
|
|
'var/lib/calculate/.execute')
|
|
|
|
'var/lib/calculate/.execute')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template_executor = TemplateExecutor(
|
|
|
|
template_executor = TemplateExecutor(chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
cl_config_archive=CONFIG_ARCHIVE_PATH,
|
|
|
|
cl_config_archive=CONFIG_ARCHIVE_PATH,
|
|
|
|
cl_config_path=CONFIG_PATH,
|
|
|
|
cl_config_path=CONFIG_PATH,
|
|
|
|
execute_archive_path=EXECUTE_ARCHIVE_PATH)
|
|
|
|
execute_archive_path=EXECUTE_ARCHIVE_PATH)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_package_name = PackageAtomName(
|
|
|
|
test_package_name = PackageAtomName(
|
|
|
|
{'pkg_path': os.path.join(
|
|
|
|
{'pkg_path': os.path.join(
|
|
|
@ -412,6 +411,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_directory,
|
|
|
|
target_directory,
|
|
|
|
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)
|
|
|
|
dir_owner = template_executor._get_file_owner(target_directory)
|
|
|
|
dir_owner = template_executor._get_file_owner(target_directory)
|
|
|
@ -434,6 +434,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_directory,
|
|
|
|
target_directory,
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
|
@ -460,6 +461,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_directory,
|
|
|
|
target_directory,
|
|
|
|
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)
|
|
|
|
template_executor._create_directory(template_wrapper)
|
|
|
|
template_executor._create_directory(template_wrapper)
|
|
|
@ -482,6 +484,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_directory,
|
|
|
|
target_directory,
|
|
|
|
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)
|
|
|
|
template_executor._create_directory(template_wrapper)
|
|
|
|
template_executor._create_directory(template_wrapper)
|
|
|
@ -509,6 +512,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_directory,
|
|
|
|
target_directory,
|
|
|
|
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)
|
|
|
|
template_executor._create_directory(template_wrapper)
|
|
|
|
template_executor._create_directory(template_wrapper)
|
|
|
@ -538,6 +542,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_directory,
|
|
|
|
target_directory,
|
|
|
|
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)
|
|
|
|
template_executor._create_directory(template_wrapper)
|
|
|
|
template_executor._create_directory(template_wrapper)
|
|
|
@ -748,6 +753,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
try:
|
|
|
|
try:
|
|
|
@ -767,6 +773,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
try:
|
|
|
|
try:
|
|
|
@ -786,6 +793,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_join_directory(template_wrapper)
|
|
|
|
template_executor._append_join_directory(template_wrapper)
|
|
|
@ -806,7 +814,9 @@ class TestTemplateExecutor:
|
|
|
|
output = template_executor.execute_template(
|
|
|
|
output = template_executor.execute_template(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
DIR, save_changes=False,
|
|
|
|
DIR,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False,
|
|
|
|
target_package=test_package)
|
|
|
|
target_package=test_package)
|
|
|
|
|
|
|
|
|
|
|
|
assert os.path.exists(target_path)
|
|
|
|
assert os.path.exists(target_path)
|
|
|
@ -826,7 +836,9 @@ class TestTemplateExecutor:
|
|
|
|
output = template_executor.execute_template(
|
|
|
|
output = template_executor.execute_template(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
DIR, save_changes=False,
|
|
|
|
DIR,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False,
|
|
|
|
target_package=test_package)
|
|
|
|
target_package=test_package)
|
|
|
|
assert output['target_path'] == join_paths(
|
|
|
|
assert output['target_path'] == join_paths(
|
|
|
|
CHROOT_PATH,
|
|
|
|
CHROOT_PATH,
|
|
|
@ -843,7 +855,9 @@ class TestTemplateExecutor:
|
|
|
|
output = template_executor.execute_template(
|
|
|
|
output = template_executor.execute_template(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
DIR, save_changes=False,
|
|
|
|
DIR,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False,
|
|
|
|
target_package=test_package)
|
|
|
|
target_package=test_package)
|
|
|
|
assert os.path.exists(target_path)
|
|
|
|
assert os.path.exists(target_path)
|
|
|
|
assert os.path.isdir(target_path)
|
|
|
|
assert os.path.isdir(target_path)
|
|
|
@ -861,6 +875,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_remove_directory(template_wrapper)
|
|
|
|
template_executor._append_remove_directory(template_wrapper)
|
|
|
@ -879,6 +894,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_remove_directory(template_wrapper)
|
|
|
|
template_executor._append_remove_directory(template_wrapper)
|
|
|
@ -896,6 +912,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_remove_directory(template_wrapper)
|
|
|
|
template_executor._append_remove_directory(template_wrapper)
|
|
|
@ -912,6 +929,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
@ -927,6 +945,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
@ -944,6 +963,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
@ -957,6 +977,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
@ -977,6 +998,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
@ -1005,6 +1027,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
@ -1020,6 +1043,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_replace_directory(template_wrapper)
|
|
|
|
template_executor._append_replace_directory(template_wrapper)
|
|
|
@ -1040,6 +1064,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_replace_directory(template_wrapper)
|
|
|
|
template_executor._append_replace_directory(template_wrapper)
|
|
|
@ -1058,6 +1083,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
@ -1079,6 +1105,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
|
template_executor._append_clear_directory(template_wrapper)
|
|
|
@ -1096,6 +1123,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_replace_directory(template_wrapper)
|
|
|
|
template_executor._append_replace_directory(template_wrapper)
|
|
|
@ -1116,6 +1144,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_replace_directory(template_wrapper)
|
|
|
|
template_executor._append_replace_directory(template_wrapper)
|
|
|
@ -1145,6 +1174,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_link_directory(template_wrapper)
|
|
|
|
template_executor._append_link_directory(template_wrapper)
|
|
|
@ -1174,6 +1204,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_link_directory(template_wrapper)
|
|
|
|
template_executor._append_link_directory(template_wrapper)
|
|
|
@ -1201,7 +1232,9 @@ class TestTemplateExecutor:
|
|
|
|
assert os.readlink(target_path) == 'dir_2'
|
|
|
|
assert os.readlink(target_path) == 'dir_2'
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
DIR, save_changes=False,
|
|
|
|
DIR,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False,
|
|
|
|
target_package=test_package)
|
|
|
|
target_package=test_package)
|
|
|
|
assert os.path.exists(target_path)
|
|
|
|
assert os.path.exists(target_path)
|
|
|
|
assert os.path.islink(target_path)
|
|
|
|
assert os.path.islink(target_path)
|
|
|
@ -1229,7 +1262,9 @@ class TestTemplateExecutor:
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
DIR, save_changes=False,
|
|
|
|
DIR,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False,
|
|
|
|
target_package=test_package)
|
|
|
|
target_package=test_package)
|
|
|
|
|
|
|
|
|
|
|
|
def test_if_execute_template_method_s_input_is_a_template_of_the_DIR_type_with_the_append_link_parameter_a_target_path_to_an_existing_link_to_a_file_that_belongs_to_the_template_package_and_force_parameter_is_set__the_method_removes_a_link_from_a_target_path_and_creates_a_link_to_a_source_directory(self):
|
|
|
|
def test_if_execute_template_method_s_input_is_a_template_of_the_DIR_type_with_the_append_link_parameter_a_target_path_to_an_existing_link_to_a_file_that_belongs_to_the_template_package_and_force_parameter_is_set__the_method_removes_a_link_from_a_target_path_and_creates_a_link_to_a_source_directory(self):
|
|
|
@ -1247,7 +1282,9 @@ class TestTemplateExecutor:
|
|
|
|
assert os.path.isfile(target_path)
|
|
|
|
assert os.path.isfile(target_path)
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
DIR, save_changes=False,
|
|
|
|
DIR,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False,
|
|
|
|
target_package=test_package)
|
|
|
|
target_package=test_package)
|
|
|
|
assert os.path.exists(target_path)
|
|
|
|
assert os.path.exists(target_path)
|
|
|
|
assert os.path.islink(target_path)
|
|
|
|
assert os.path.islink(target_path)
|
|
|
@ -1274,7 +1311,9 @@ class TestTemplateExecutor:
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
DIR, save_changes=False,
|
|
|
|
DIR,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False,
|
|
|
|
target_package=test_package)
|
|
|
|
target_package=test_package)
|
|
|
|
|
|
|
|
|
|
|
|
def test_if_execute_template_method_s_input_is_a_template_of_the_DIR_type_with_the_append_link_parameter_a_target_path_to_an_existing_file_that_belongs_to_the_template_package_and_force_parameter_is_set__the_method_removes_a_file_from_a_target_path_and_creates_a_link_to_a_source_directory(self):
|
|
|
|
def test_if_execute_template_method_s_input_is_a_template_of_the_DIR_type_with_the_append_link_parameter_a_target_path_to_an_existing_file_that_belongs_to_the_template_package_and_force_parameter_is_set__the_method_removes_a_file_from_a_target_path_and_creates_a_link_to_a_source_directory(self):
|
|
|
@ -1291,7 +1330,9 @@ class TestTemplateExecutor:
|
|
|
|
assert os.path.isfile(target_path)
|
|
|
|
assert os.path.isfile(target_path)
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
DIR, save_changes=False,
|
|
|
|
DIR,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False,
|
|
|
|
target_package=test_package)
|
|
|
|
target_package=test_package)
|
|
|
|
assert os.path.exists(target_path)
|
|
|
|
assert os.path.exists(target_path)
|
|
|
|
assert os.path.islink(target_path)
|
|
|
|
assert os.path.islink(target_path)
|
|
|
@ -1318,7 +1359,9 @@ class TestTemplateExecutor:
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
DIR, save_changes=False,
|
|
|
|
DIR,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False,
|
|
|
|
target_package=test_package)
|
|
|
|
target_package=test_package)
|
|
|
|
|
|
|
|
|
|
|
|
def test_if_execute_template_method_s_input_is_a_template_of_the_DIR_type_with_the_append_link_parameter_a_target_path_to_an_existing_directory_that_belongs_to_the_template_package_and_force_parameter_is_set__the_method_removes_a_directory_from_a_target_path_and_creates_a_link_to_a_source_directory(self):
|
|
|
|
def test_if_execute_template_method_s_input_is_a_template_of_the_DIR_type_with_the_append_link_parameter_a_target_path_to_an_existing_directory_that_belongs_to_the_template_package_and_force_parameter_is_set__the_method_removes_a_directory_from_a_target_path_and_creates_a_link_to_a_source_directory(self):
|
|
|
@ -1335,7 +1378,9 @@ class TestTemplateExecutor:
|
|
|
|
assert os.path.isdir(target_path)
|
|
|
|
assert os.path.isdir(target_path)
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
DIR, save_changes=False,
|
|
|
|
DIR,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False,
|
|
|
|
target_package=test_package)
|
|
|
|
target_package=test_package)
|
|
|
|
assert os.path.exists(target_path)
|
|
|
|
assert os.path.exists(target_path)
|
|
|
|
assert os.path.islink(target_path)
|
|
|
|
assert os.path.islink(target_path)
|
|
|
@ -1356,11 +1401,19 @@ class TestTemplateExecutor:
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind'})
|
|
|
|
'format': 'bind'})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text = 'section-name {\n parameter-2 no;\n};\n'
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
|
|
|
|
('section-name {\n'
|
|
|
|
|
|
|
|
' parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1382,11 +1435,19 @@ class TestTemplateExecutor:
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind'})
|
|
|
|
'format': 'bind'})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text = 'section-name {\n parameter-2 no;\n};\n'
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
|
|
|
|
('section-name {\n'
|
|
|
|
|
|
|
|
' parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1410,11 +1471,19 @@ class TestTemplateExecutor:
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind',
|
|
|
|
'format': 'bind',
|
|
|
|
'autoupdate': True})
|
|
|
|
'autoupdate': True})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text = 'section-name {\n parameter-2 no;\n};\n'
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
|
|
|
|
('section-name {\n'
|
|
|
|
|
|
|
|
' parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1443,11 +1512,20 @@ class TestTemplateExecutor:
|
|
|
|
'format': 'bind',
|
|
|
|
'format': 'bind',
|
|
|
|
'chown': chown_value,
|
|
|
|
'chown': chown_value,
|
|
|
|
'chmod': chmod_value})
|
|
|
|
'chmod': chmod_value})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text = 'section-name {\n parameter-2 no;\n};\n'
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
|
|
|
|
('section-name {\n'
|
|
|
|
|
|
|
|
' parameter-2 no;\n'
|
|
|
|
|
|
|
|
'};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1478,11 +1556,19 @@ class TestTemplateExecutor:
|
|
|
|
'chmod': chmod_value})
|
|
|
|
'chmod': chmod_value})
|
|
|
|
output_path = os.path.join(os.path.dirname(target_path),
|
|
|
|
output_path = os.path.join(os.path.dirname(target_path),
|
|
|
|
'._cfg0001_file_4')
|
|
|
|
'._cfg0001_file_4')
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text = 'section-name {\n parameter-2 no;\n};\n'
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
|
|
|
|
('section-name {'
|
|
|
|
|
|
|
|
'\n parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1507,12 +1593,19 @@ class TestTemplateExecutor:
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind'})
|
|
|
|
'format': 'bind'})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 yes;\n parameter-2 no;\n};\n'
|
|
|
|
('section-name {\n parameter-1 yes;'
|
|
|
|
|
|
|
|
'\n parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1541,12 +1634,19 @@ class TestTemplateExecutor:
|
|
|
|
'format': 'bind',
|
|
|
|
'format': 'bind',
|
|
|
|
'chown': chown_value,
|
|
|
|
'chown': chown_value,
|
|
|
|
'chmod': chmod_value})
|
|
|
|
'chmod': chmod_value})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 yes;\n parameter-2 no;\n};\n'
|
|
|
|
('section-name {\n parameter-1 yes;'
|
|
|
|
|
|
|
|
'\n parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1574,12 +1674,19 @@ class TestTemplateExecutor:
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind'})
|
|
|
|
'format': 'bind'})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 yes;\n parameter-2 no;\n};\n'
|
|
|
|
('section-name {\n parameter-1 yes;'
|
|
|
|
|
|
|
|
'\n parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1606,12 +1713,19 @@ class TestTemplateExecutor:
|
|
|
|
'format': 'bind',
|
|
|
|
'format': 'bind',
|
|
|
|
'chown': chown_value,
|
|
|
|
'chown': chown_value,
|
|
|
|
'chmod': chmod_value})
|
|
|
|
'chmod': chmod_value})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 yes;\n parameter-2 no;\n};\n'
|
|
|
|
('section-name {\n parameter-1 yes;'
|
|
|
|
|
|
|
|
'\n parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1637,12 +1751,19 @@ class TestTemplateExecutor:
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind',
|
|
|
|
'format': 'bind',
|
|
|
|
'autoupdate': True})
|
|
|
|
'autoupdate': True})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 no;\n parameter-2 no;\n};\n'
|
|
|
|
('section-name {\n parameter-1 no;'
|
|
|
|
|
|
|
|
'\n parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1670,12 +1791,19 @@ class TestTemplateExecutor:
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind',
|
|
|
|
'format': 'bind',
|
|
|
|
'autoupdate': True})
|
|
|
|
'autoupdate': True})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-4 yes; }'
|
|
|
|
template_text = 'section-name { parameter-4 yes; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 yes;\n parameter-4 yes;\n};\n'
|
|
|
|
('section-name {\n parameter-1 yes;'
|
|
|
|
|
|
|
|
'\n parameter-4 yes;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1709,13 +1837,20 @@ class TestTemplateExecutor:
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind'})
|
|
|
|
'format': 'bind'})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-4 yes; }'
|
|
|
|
template_text = 'section-name { parameter-4 yes; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 yes;\n parameter-4 yes;\n};\n'
|
|
|
|
('section-name {\n parameter-1 yes;'
|
|
|
|
|
|
|
|
'\n parameter-4 yes;\n};\n'))
|
|
|
|
output_md5 = hashlib.md5(output_text.encode()).hexdigest()
|
|
|
|
output_md5 = hashlib.md5(output_text.encode()).hexdigest()
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1747,13 +1882,20 @@ class TestTemplateExecutor:
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind'})
|
|
|
|
'format': 'bind'})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-3 10; }'
|
|
|
|
template_text = 'section-name { parameter-3 10; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 yes;\n parameter-3 10;\n};\n'
|
|
|
|
('section-name {\n parameter-1 yes;'
|
|
|
|
|
|
|
|
'\n parameter-3 10;\n};\n'))
|
|
|
|
output_md5 = hashlib.md5(output_text.encode()).hexdigest()
|
|
|
|
output_md5 = hashlib.md5(output_text.encode()).hexdigest()
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1778,12 +1920,19 @@ class TestTemplateExecutor:
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind'})
|
|
|
|
'format': 'bind'})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 yes;\n parameter-2 no;\n};\n'
|
|
|
|
('section-name {\n parameter-1 yes;'
|
|
|
|
|
|
|
|
'\n parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1811,12 +1960,19 @@ class TestTemplateExecutor:
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind'})
|
|
|
|
'format': 'bind'})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 no;\n parameter-2 no;\n};\n'
|
|
|
|
('section-name {\n parameter-1 no;'
|
|
|
|
|
|
|
|
'\n parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1846,12 +2002,19 @@ class TestTemplateExecutor:
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind',
|
|
|
|
'format': 'bind',
|
|
|
|
'unbound': True})
|
|
|
|
'unbound': True})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 yes;\n parameter-2 no;\n};\n'
|
|
|
|
('section-name {\n parameter-1 yes;'
|
|
|
|
|
|
|
|
'\n parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1877,12 +2040,19 @@ class TestTemplateExecutor:
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind',
|
|
|
|
'format': 'bind',
|
|
|
|
'unbound': True})
|
|
|
|
'unbound': True})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 no;\n parameter-2 no;\n};\n'
|
|
|
|
('section-name {\n parameter-1 no;'
|
|
|
|
|
|
|
|
'\n parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1915,12 +2085,19 @@ class TestTemplateExecutor:
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind',
|
|
|
|
'format': 'bind',
|
|
|
|
'unbound': True})
|
|
|
|
'unbound': True})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
'section-name {\n parameter-1 no;\n parameter-2 no;\n};\n'
|
|
|
|
('section-name {\n parameter-1 no;'
|
|
|
|
|
|
|
|
'\n parameter-2 no;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -1956,7 +2133,9 @@ class TestTemplateExecutor:
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE, save_changes=False,
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False,
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
target_package=test_package)
|
|
|
|
target_package=test_package)
|
|
|
|
|
|
|
|
|
|
|
@ -1970,14 +2149,22 @@ class TestTemplateExecutor:
|
|
|
|
'append': 'join',
|
|
|
|
'append': 'join',
|
|
|
|
'format': 'bind',
|
|
|
|
'format': 'bind',
|
|
|
|
'force': True})
|
|
|
|
'force': True})
|
|
|
|
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
template_text = 'section-name { parameter-2 no; }'
|
|
|
|
output_text =\
|
|
|
|
output_text = '{}{}'.format(
|
|
|
|
'section-name {\n parameter-2 no;\n};\n'
|
|
|
|
header,
|
|
|
|
|
|
|
|
'section-name {\n parameter-2 no;\n};\n')
|
|
|
|
|
|
|
|
|
|
|
|
assert os.path.isdir(target_path)
|
|
|
|
assert os.path.isdir(target_path)
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE, save_changes=False,
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False,
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
target_package=test_package)
|
|
|
|
target_package=test_package)
|
|
|
|
|
|
|
|
|
|
|
@ -2001,12 +2188,21 @@ class TestTemplateExecutor:
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
'append': 'after',
|
|
|
|
'append': 'after',
|
|
|
|
'format': 'bind'})
|
|
|
|
'format': 'bind'})
|
|
|
|
template_text = 'section-1 { parameter-2 no; } section-2 { parameter-1 10; }'
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
output_text =\
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
'section-1 {\n parameter-1 yes;\n parameter-2 no;\n};\n\nsection-2 {\n parameter-1 10;\n};\n'
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
|
|
|
|
template_text = ('section-1 { parameter-2 no; }'
|
|
|
|
|
|
|
|
'section-2 { parameter-1 10; }')
|
|
|
|
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
|
|
|
|
('section-1 {\n parameter-1 yes;'
|
|
|
|
|
|
|
|
'\n parameter-2 no;\n};\n\n'
|
|
|
|
|
|
|
|
'section-2 {\n parameter-1 10;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -2026,12 +2222,21 @@ class TestTemplateExecutor:
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
'append': 'before',
|
|
|
|
'append': 'before',
|
|
|
|
'format': 'bind'})
|
|
|
|
'format': 'bind'})
|
|
|
|
template_text = 'section-1 { parameter-1 no; } section-2 { parameter-2 10; }'
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
output_text =\
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
'section-1 {\n parameter-1 no;\n};\n\nsection-2 {\n parameter-1 yes;\n parameter-2 10;\n};\n'
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
|
|
|
|
template_text = ('section-1 { parameter-1 no; }'
|
|
|
|
|
|
|
|
'section-2 { parameter-2 10; }')
|
|
|
|
|
|
|
|
output_text = '{}{}'.format(header,
|
|
|
|
|
|
|
|
('section-1 {\n parameter-1 no;\n};\n'
|
|
|
|
|
|
|
|
'\nsection-2 {\n parameter-1 yes;'
|
|
|
|
|
|
|
|
'\n parameter-2 10;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -2052,12 +2257,21 @@ class TestTemplateExecutor:
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
'append': 'replace',
|
|
|
|
'append': 'replace',
|
|
|
|
'format': 'bind'})
|
|
|
|
'format': 'bind'})
|
|
|
|
template_text = 'section-1 { parameter-1 no; }; section-2 { parameter-1 10; }'
|
|
|
|
header = ('#' + '-' * 79 + '\n' +
|
|
|
|
output_text =\
|
|
|
|
'# Modified by Calculate Utilities 4.0\n' +
|
|
|
|
'section-1 {\n parameter-1 no;\n};\n\nsection-2 {\n parameter-1 10;\n};\n'
|
|
|
|
'# Processed template files:\n' +
|
|
|
|
|
|
|
|
'# /path/to/template\n' +
|
|
|
|
|
|
|
|
'#' + '-' * 79 + '\n')
|
|
|
|
|
|
|
|
template_text = ('section-1 { parameter-1 no; };'
|
|
|
|
|
|
|
|
'section-2 { parameter-1 10; }')
|
|
|
|
|
|
|
|
output_text = '{}{}'.format(
|
|
|
|
|
|
|
|
header,
|
|
|
|
|
|
|
|
('section-1 {\n parameter-1 no;\n};\n'
|
|
|
|
|
|
|
|
'\nsection-2 {\n parameter-1 10;\n};\n'))
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object, FILE,
|
|
|
|
parameters_object, FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
chroot_path=CHROOT_PATH,
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
|
config_archive_path=CONFIG_ARCHIVE_PATH)
|
|
|
@ -2083,6 +2297,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_remove_file(template_wrapper)
|
|
|
|
template_executor._append_remove_file(template_wrapper)
|
|
|
@ -2099,6 +2314,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_remove_file(template_wrapper)
|
|
|
|
template_executor._append_remove_file(template_wrapper)
|
|
|
@ -2114,6 +2330,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_remove_file(template_wrapper)
|
|
|
|
template_executor._append_remove_file(template_wrapper)
|
|
|
@ -2130,6 +2347,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_clear_file(template_wrapper)
|
|
|
|
template_executor._append_clear_file(template_wrapper)
|
|
|
@ -2148,6 +2366,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_clear_file(template_wrapper)
|
|
|
|
template_executor._append_clear_file(template_wrapper)
|
|
|
@ -2171,6 +2390,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_clear_file(template_wrapper)
|
|
|
|
template_executor._append_clear_file(template_wrapper)
|
|
|
@ -2200,6 +2420,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_link_file(template_wrapper)
|
|
|
|
template_executor._append_link_file(template_wrapper)
|
|
|
@ -2229,6 +2450,7 @@ class TestTemplateExecutor:
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
template_wrapper = TemplateWrapper(
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
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)
|
|
|
|
template_executor._append_link_file(template_wrapper)
|
|
|
|
template_executor._append_link_file(template_wrapper)
|
|
|
@ -2249,8 +2471,10 @@ class TestTemplateExecutor:
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
parameters_object = ParametersContainer({'package': test_package_name,
|
|
|
|
'run': '/usr/bin/python'})
|
|
|
|
'run': '/usr/bin/python'})
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE, save_changes=False)
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False)
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
|
|
@ -2265,6 +2489,7 @@ print(os.getcwd())'''
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE,
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
save_changes=False)
|
|
|
|
save_changes=False)
|
|
|
|
assert output['stdout'].strip() == target_path
|
|
|
|
assert output['stdout'].strip() == target_path
|
|
|
@ -2279,7 +2504,9 @@ print(os.getcwd())'''
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE, save_changes=False)
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False)
|
|
|
|
|
|
|
|
|
|
|
|
def test_if_the_execute_template_method_s_input_is_a_template_with_the_run_parameter_and_a_target_path_to_an_existing_file_and_its_text_is_correct__the_method_runs_a_template_text_in_a_directory_that_contains_a_file_from_a_target_path_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_file_and_its_text_is_correct__the_method_runs_a_template_text_in_a_directory_that_contains_a_file_from_a_target_path_and_returns_the_object_with_its_stdout(self):
|
|
|
|
target_path = join_paths(
|
|
|
|
target_path = join_paths(
|
|
|
@ -2294,6 +2521,7 @@ print(os.getcwd())'''
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE,
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
save_changes=False)
|
|
|
|
save_changes=False)
|
|
|
|
assert output['stdout'].strip() == os.path.dirname(target_path)
|
|
|
|
assert output['stdout'].strip() == os.path.dirname(target_path)
|
|
|
@ -2308,7 +2536,9 @@ print(os.getcwd())'''
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE, save_changes=False)
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False)
|
|
|
|
|
|
|
|
|
|
|
|
def test_if_the_execute_template_method_s_input_is_a_template_with_the_run_parameter_a_target_path_to_an_existing_directory_and_its_text_is_not_correct__the_method_runs_a_template_text_and_returns_the_object_with_its_stderr(self):
|
|
|
|
def test_if_the_execute_template_method_s_input_is_a_template_with_the_run_parameter_a_target_path_to_an_existing_directory_and_its_text_is_not_correct__the_method_runs_a_template_text_and_returns_the_object_with_its_stderr(self):
|
|
|
|
target_path = join_paths(
|
|
|
|
target_path = join_paths(
|
|
|
@ -2328,6 +2558,7 @@ print(os.suspicious_attribute)'''
|
|
|
|
target_path,
|
|
|
|
target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE,
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
save_changes=False)
|
|
|
|
save_changes=False)
|
|
|
|
assert output['stdout'] is None
|
|
|
|
assert output['stdout'] is None
|
|
|
@ -2346,6 +2577,7 @@ print(os.getcwd())'''
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE,
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
save_changes=False)
|
|
|
|
save_changes=False)
|
|
|
|
|
|
|
|
|
|
|
@ -2359,7 +2591,9 @@ print(os.getcwd())'''
|
|
|
|
'exec': interpreter})
|
|
|
|
'exec': interpreter})
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE, save_changes=False)
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False)
|
|
|
|
assert os.path.exists(execute_file_path)
|
|
|
|
assert os.path.exists(execute_file_path)
|
|
|
|
assert template_executor.execute_files[execute_file_path][
|
|
|
|
assert template_executor.execute_files[execute_file_path][
|
|
|
|
'interpreter'] == interpreter
|
|
|
|
'interpreter'] == interpreter
|
|
|
@ -2387,6 +2621,7 @@ print(os.getcwd())'''
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE,
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
save_changes=False)
|
|
|
|
save_changes=False)
|
|
|
|
assert os.path.exists(execute_file_path)
|
|
|
|
assert os.path.exists(execute_file_path)
|
|
|
@ -2411,7 +2646,9 @@ print(os.getcwd())'''
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE, save_changes=False)
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False)
|
|
|
|
|
|
|
|
|
|
|
|
def test_if_the_execute_template_method_s_input_is_a_template_with_the_exec_parameter_and_a_target_path_to_an_existing_file_and_its_text_is_not_empty__the_method_creates_an_exec_file_and_saves_a_path_to_exec_file_interpreter_and_a_path_to_a_file_from_a_target_path_as_cwd_path(self):
|
|
|
|
def test_if_the_execute_template_method_s_input_is_a_template_with_the_exec_parameter_and_a_target_path_to_an_existing_file_and_its_text_is_not_empty__the_method_creates_an_exec_file_and_saves_a_path_to_exec_file_interpreter_and_a_path_to_a_file_from_a_target_path_as_cwd_path(self):
|
|
|
|
target_path = join_paths(CHROOT_PATH,
|
|
|
|
target_path = join_paths(CHROOT_PATH,
|
|
|
@ -2426,6 +2663,7 @@ print(os.getcwd())'''
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE,
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
save_changes=False)
|
|
|
|
save_changes=False)
|
|
|
|
assert os.path.exists(execute_file_path)
|
|
|
|
assert os.path.exists(execute_file_path)
|
|
|
@ -2450,7 +2688,9 @@ print(os.getcwd())'''
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
with pytest.raises(TemplateExecutorError):
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE, save_changes=False)
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
|
|
|
|
save_changes=False)
|
|
|
|
|
|
|
|
|
|
|
|
def test_if_the_execute_template_method_s_input_is_a_several_templates_with_the_exec_parameter_and_a_target_paths_to_an_existing_directories_and_files_and_its_text_is_not_empty__the_method_creates_some_exec_files_and_saves_a_paths_to_exec_files_its_interpreters_and_paths_to_a_directories_from_a_target_path_as_cwd_path(self):
|
|
|
|
def test_if_the_execute_template_method_s_input_is_a_several_templates_with_the_exec_parameter_and_a_target_paths_to_an_existing_directories_and_files_and_its_text_is_not_empty__the_method_creates_some_exec_files_and_saves_a_paths_to_exec_files_its_interpreters_and_paths_to_a_directories_from_a_target_path_as_cwd_path(self):
|
|
|
|
interpreter = '/usr/bin/python'
|
|
|
|
interpreter = '/usr/bin/python'
|
|
|
@ -2471,6 +2711,7 @@ print(os.getcwd())'''
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE,
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
save_changes=False)
|
|
|
|
save_changes=False)
|
|
|
|
counter += 1
|
|
|
|
counter += 1
|
|
|
@ -2506,6 +2747,7 @@ print(os.getcwd())'''
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE,
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
save_changes=False)
|
|
|
|
save_changes=False)
|
|
|
|
|
|
|
|
|
|
|
@ -2538,6 +2780,7 @@ AttributeError: module 'os' has no attribute 'suspicious_attribute'
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
template_executor.execute_template(target_path,
|
|
|
|
parameters_object,
|
|
|
|
parameters_object,
|
|
|
|
FILE,
|
|
|
|
FILE,
|
|
|
|
|
|
|
|
'/path/to/template',
|
|
|
|
template_text=template_text,
|
|
|
|
template_text=template_text,
|
|
|
|
save_changes=False)
|
|
|
|
save_changes=False)
|
|
|
|
|
|
|
|
|
|
|
|