-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/strip-j2-jinja: implement rstrip for jinja2 input (#916)
* feat/strip-j2-jinja: implement rstrip for jinja2 input Added options "strip_postfix" and "stripped_postfix" to jinja2 input. This allows to remove output files extensions which is often the case for jinja2 template files (.j2). Stripping is disabled by default and default value to strip is ".j2". * feat/strip-j2-jinja: rename strip dropping parameters Rename parameters for suffix removal in jinja2 compile step. Rename: strip_postfix -> suffix_remove stripped_postfix -> suffix_stripped * feat/strip-j2-jinja: apply formatter
- Loading branch information
Showing
8 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
tests/test_resources/compiled/jinja2-postfix-strip/stripped-overridden/stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Is this a Jinja2 template? | ||
Yes! |
2 changes: 2 additions & 0 deletions
2
tests/test_resources/compiled/jinja2-postfix-strip/stripped/stub.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Is this a Jinja2 template? | ||
Yes! |
2 changes: 2 additions & 0 deletions
2
tests/test_resources/compiled/jinja2-postfix-strip/unstripped/stub.txt.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Is this a Jinja2 template? | ||
Yes! |
29 changes: 29 additions & 0 deletions
29
tests/test_resources/inventory/targets/jinja2-postfix-strip.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
parameters: | ||
kapitan: | ||
vars: | ||
target: jinja2-postfix-strip | ||
compile: | ||
- output_path: stripped/ | ||
input_type: jinja2 | ||
input_paths: | ||
- templates/stub.txt.j2 | ||
input_params: | ||
name: test1 | ||
namespace: ns1 | ||
suffix_remove: true | ||
- output_path: stripped-overridden/ | ||
input_type: jinja2 | ||
input_paths: | ||
- templates/stub.txt.j2 | ||
input_params: | ||
name: test2 | ||
namespace: ns2 | ||
suffix_remove: true | ||
suffix_stripped: .txt.j2 | ||
- output_path: unstripped/ | ||
input_type: jinja2 | ||
input_paths: | ||
- templates/stub.txt.j2 | ||
input_params: | ||
name: test2 | ||
namespace: ns2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Is this a Jinja2 template? | ||
{% if True %} | ||
Yes! | ||
{% endif %} |