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

Templates can only be loaded from templates/ folder in working directory? #596

Open
amotl opened this issue Sep 22, 2022 · 3 comments
Open

Comments

@amotl
Copy link
Member

amotl commented Sep 22, 2022

Hi there,

we are apparently not using that feature too much, that is why we are asking the community about it.

Is it possible that mqttwarn can only load templates from the templates/ folder in current working directory? According to the implementation, it looks like it is - please correct me if I'm wrong.

https://github.com/jpmens/mqttwarn/blob/b8e61e224b3d6cbad6605870d6e518be7f815133/mqttwarn/core.py#L37-L45

Do you think it should be improved?

With kind regards,
Andreas.

@amotl amotl changed the title Templates can only be loaded from templates/ folder in working directory Templates can only be loaded from templates/ folder in working directory? Sep 22, 2022
@jpmens
Copy link
Collaborator

jpmens commented Sep 23, 2022

It's never been reported as a problem, and I can't really imagine it is. I selected the name templates/ because it sounded reasonable, (and because that's the default in Ansible :-) ).

@amotl
Copy link
Member Author

amotl commented Sep 23, 2022

Hi JP,

I selected the name templates/ because it sounded reasonable.

The name is perfectly reasonable. I was just wondering if the location of the folder should be made more flexible. When it never has been a problem, then I will back off.

I am just remembering the time when mqttwarn would mostly load an mqttwarn.ini file from the current working directory. In this scenario it would be perfectly fine to assume the templates/ folder is right side-by-side.

However, I think we made some adjustments to improve the location resolvement for the function file, for example. And I think we may want to apply the same logic to the location resolvement of the Jinja2 template folder.

I am not completely sure about current the state (will have to investigate), but just wanted to take a note about it while I came across the corresponding lines of code while writing more tests yesterday, and listen to what you think about it.

With kind regards,
Andreas.

@jpmens
Copy link
Collaborator

jpmens commented Sep 23, 2022

Maybe templates/ could be a default if the path to the template file is not absolute.

I don't think changing the behaviour would break very much.

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

No branches or pull requests

2 participants