-
Notifications
You must be signed in to change notification settings - Fork 36
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
Bug when using variables in imports
#317
Comments
This is a fix for the current issue, but it's not generic enough. Can you think of other cases when quotes are not necessary in the #
# imports?
#
if 'imports' in obj:
for item in obj['imports']:
if item.startswith('host.vars'):
object_content += ' import ' + str(item) + '\n'
else:
object_content += ' import "' + str(item) + '"\n'
object_content += '\n' |
I didn't know this was even possible within the DSL. Thanks, we basically need to detect if it is a custom var and then apply it. Does it work with constants as well? :D |
@mkayontour Yes, I just verified that it also works with constants. Here's an example: constants.conf
services.conf
|
Hi all
I want to create a Service which imports a Service Template. We have four different Service Templates, depending on the priority. My idea was to add a variable to the host and then import the specified service template.
Here's an example Host object:
And here's the Service object that I want to create:
The problem is that the
icinga2_object.py
script adds the import as string, not as variable. So the rendered config looks like this:But it should look like this (import without quotes):
I'm not quite sure how this can be solved. Because sometimes the import should be a string, e.g. if I import
priority1-service
directly, but if it's a variable, it should be without quotes...The text was updated successfully, but these errors were encountered: