forked from aws/aws-parallelcluster-cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
31 additions
and
32 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
cookbooks/aws-parallelcluster-environment/files/cloudwatch/cloudwatch_agent_common_utils.py
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,17 @@ | ||
import os | ||
|
||
from jinja2 import FileSystemLoader | ||
from jinja2.sandbox import SandboxedEnvironment | ||
|
||
CONFIG_ARGS = { | ||
"default_platforms": ["amazon", "centos", "redhat", "rocky", "ubuntu"], | ||
} | ||
|
||
|
||
def render_jinja_template(template_file_path): | ||
file_loader = FileSystemLoader(str(os.path.dirname(template_file_path))) | ||
env = SandboxedEnvironment(loader=file_loader) | ||
rendered_template = env.get_template(os.path.basename(template_file_path)).render(**CONFIG_ARGS) | ||
with open(template_file_path, "w", encoding="utf-8") as f: | ||
f.write(rendered_template) | ||
return template_file_path |
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