Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python-modules: add register_jinja_config_generator convenience fn #4467

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alltilla
Copy link
Collaborator

@alltilla alltilla commented May 10, 2023

Example usage:

python {
import syslogng

syslogng.register_jinja_config_generator(context="destination", name="my_dest", template=r"""

file({{ args.path }});

""")
};

destination d_my_dest{
  my-dest(path("/dev/stdout"));
};

TODO: make it possible to load .jinja file.

Signed-off-by: Attila Szakacs attila.szakacs@axoflow.com

Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
@alltilla alltilla marked this pull request as draft May 12, 2023 06:30
return jinja2_template.render(args=args)
register_config_generator(context, name, jinja_confgen_fn)
except ImportError:
def register_jinja_config_generator(context, name, template):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should raise an exception if called as jinja2 might be unavailable if the user is not using a virtualenv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants