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

[dev.icinga.com #13541] Incorrect escaping variable on template #647

Closed
icinga-migration opened this issue Dec 12, 2016 · 2 comments
Closed
Labels

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/13541

Created by TheFlyingCorpse on 2016-12-12 22:29:59 +00:00

Assignee: (none)
Status: New
Target Version: (none)
Last Update: 2016-12-12 22:29:59 +00:00 (in Redmine)


There is an issue when you use inherit from template on vars. In the template it is set as a string, while the apply rule removes the $'s and "'s before correctly setting them to the var.

Example:
constants.conf

...
const TestSnmpv2Community = "v2"
const TestSnmpv3Community = "v3"

service_templates.conf:

template Service "_Icinga2LocalCheck" {
    check_interval = 1m
    retry_interval = 1m
    command_endpoint = host_name
}
template Service "dummy" {
    import "_Icinga2LocalCheck"

    check_command = "dummy"
    vars.dummy_state = "0"
    vars.dummy_text = "$TestSnmpv2Community$"
}

^ error is there, it does not store the string the same way as the apply rule, in Director I store the string as $TestSnmpv2Community$, on the template its encapsulated, in the apply rule it is stored as a direct var without the $'s and "'s.
I just get it to say "vars.dummy_text = TestSnmpv2Community" on the template, I only get that on the apply rule.

service_apply.conf

apply Service "dummy" {
    import "dummy"

    assign where host.name == "ryglov09.labdomain.net"
}

apply Service "dummy3" {
    import "dummy"

    assign where host.name == "ryglov09.labdomain.net"
    vars.dummy_text = TestSnmpv2Community
}

apply Service "dummy4" {
    import "dummy"

    assign where host.name == "ryglov09.labdomain.net"
    vars.dummy_text = TestSnmpv3Community
}

Output if I dont modify is:
dummy: "OK: "
dummy3: "OK v2"
dummy4: "OK v3"

I expected dummy to return "OK: v2"

@TheFlyingCorpse
Copy link

Subscribed.

@Thomas-Gelf
Copy link
Contributor

This should have been fixed, in case the problem persists please let me know.

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

No branches or pull requests

3 participants