From b094e5a6ca9d49fba6bff944f09336f2a4bd2421 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 21 Feb 2021 11:04:55 +0100 Subject: [PATCH] test patch with jinja2 --- tests/dictionaries/01base_file_patch/00-base.xml | 1 + .../dictionaries/01base_file_patch/makedict/base.json | 2 +- .../01base_file_patch/patches/file2.patch | 5 +++++ tests/dictionaries/01base_file_patch/result/etc/file2 | 1 + .../01base_file_patch/result/tmpfiles.d/rougail.conf | 2 ++ tests/dictionaries/01base_file_patch/tiramisu/base.py | 11 ++++++++++- tests/dictionaries/01base_file_patch/tmpl/file2 | 1 + 7 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/dictionaries/01base_file_patch/patches/file2.patch create mode 100644 tests/dictionaries/01base_file_patch/result/etc/file2 create mode 100644 tests/dictionaries/01base_file_patch/tmpl/file2 diff --git a/tests/dictionaries/01base_file_patch/00-base.xml b/tests/dictionaries/01base_file_patch/00-base.xml index c5d31337..5e1ac5f7 100644 --- a/tests/dictionaries/01base_file_patch/00-base.xml +++ b/tests/dictionaries/01base_file_patch/00-base.xml @@ -4,6 +4,7 @@ /etc/file + /etc/file2 diff --git a/tests/dictionaries/01base_file_patch/makedict/base.json b/tests/dictionaries/01base_file_patch/makedict/base.json index 04a10642..a09c3a9c 100644 --- a/tests/dictionaries/01base_file_patch/makedict/base.json +++ b/tests/dictionaries/01base_file_patch/makedict/base.json @@ -1 +1 @@ -{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.include": "no", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.activate": true} +{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.engine": "creole", "services.test.files.file.group": "root", "services.test.files.file.include": "no", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.activate": true, "services.test.files.file2.engine": "jinja2", "services.test.files.file2.group": "root", "services.test.files.file2.include": "no", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/etc/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.activate": true} diff --git a/tests/dictionaries/01base_file_patch/patches/file2.patch b/tests/dictionaries/01base_file_patch/patches/file2.patch new file mode 100644 index 00000000..d44031f6 --- /dev/null +++ b/tests/dictionaries/01base_file_patch/patches/file2.patch @@ -0,0 +1,5 @@ +--- tmpl/file2 2020-11-20 07:44:38.588472784 +0100 ++++ dest/file2 2020-11-20 07:44:54.588536011 +0100 +@@ -1 +1 @@ +-unpatched ++patched diff --git a/tests/dictionaries/01base_file_patch/result/etc/file2 b/tests/dictionaries/01base_file_patch/result/etc/file2 new file mode 100644 index 00000000..893adcd3 --- /dev/null +++ b/tests/dictionaries/01base_file_patch/result/etc/file2 @@ -0,0 +1 @@ +patched diff --git a/tests/dictionaries/01base_file_patch/result/tmpfiles.d/rougail.conf b/tests/dictionaries/01base_file_patch/result/tmpfiles.d/rougail.conf index 574c7b82..2dab2179 100644 --- a/tests/dictionaries/01base_file_patch/result/tmpfiles.d/rougail.conf +++ b/tests/dictionaries/01base_file_patch/result/tmpfiles.d/rougail.conf @@ -1,2 +1,4 @@ C /etc/file 0644 root root - /usr/local/lib/etc/file z /etc/file - - - - - +C /etc/file2 0644 root root - /usr/local/lib/etc/file2 +z /etc/file2 - - - - - diff --git a/tests/dictionaries/01base_file_patch/tiramisu/base.py b/tests/dictionaries/01base_file_patch/tiramisu/base.py index c862eab0..ee74b1ce 100644 --- a/tests/dictionaries/01base_file_patch/tiramisu/base.py +++ b/tests/dictionaries/01base_file_patch/tiramisu/base.py @@ -23,7 +23,16 @@ option_13 = StrOption(name="owner", doc="owner", default="root") option_14 = StrOption(name="source", doc="source", default="file") option_15 = BoolOption(name="activate", doc="activate", default=True) option_7 = OptionDescription(name="file", doc="file", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) -option_6 = OptionDescription(name="files", doc="files", children=[option_7]) +option_17 = StrOption(name="engine", doc="engine", default="jinja2") +option_18 = StrOption(name="group", doc="group", default="root") +option_19 = StrOption(name="include", doc="include", default="no") +option_20 = StrOption(name="mode", doc="mode", default="0644") +option_21 = FilenameOption(name="name", doc="name", default="/etc/file2") +option_22 = StrOption(name="owner", doc="owner", default="root") +option_23 = StrOption(name="source", doc="source", default="file2") +option_24 = BoolOption(name="activate", doc="activate", default=True) +option_16 = OptionDescription(name="file2", doc="file2", children=[option_17, option_18, option_19, option_20, option_21, option_22, option_23, option_24]) +option_6 = OptionDescription(name="files", doc="files", children=[option_7, option_16]) option_5 = OptionDescription(name="test", doc="test", children=[option_6]) option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/01base_file_patch/tmpl/file2 b/tests/dictionaries/01base_file_patch/tmpl/file2 new file mode 100644 index 00000000..832551d8 --- /dev/null +++ b/tests/dictionaries/01base_file_patch/tmpl/file2 @@ -0,0 +1 @@ +unpatched