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

Bug when dict key is an integer #342

Open
lucagubler opened this issue Nov 8, 2024 · 0 comments · May be fixed by #345
Open

Bug when dict key is an integer #342

lucagubler opened this issue Nov 8, 2024 · 0 comments · May be fixed by #345

Comments

@lucagubler
Copy link
Contributor

Hi all

I think there's a bug when we process a dict where the key is an integer. I added a JSON object to a device in NetBox and want to load and append this JSON to a Host object. The key is an AS number, e.g. 1234. Inside of the NetBox dict, this key is surrounded by quotes. However, the Icinga2Parser detects this as integer and doesn't add quotes around it, which will lead to an invalid config.

actual rendered example_host.conf

object Host "rt01zrh2.wlp.is" {
  ...
  vars.nb["config"] = {
    bgp_sessions = {
      asn = {
        1234 = "BGP 1"
        2345 = "BGP 2"
    }
  }
}

desired outcome with quotes around the AS number

object Host "rt01zrh2.wlp.is" {
  ...
  vars.nb["config"] = {
    bgp_sessions = {
      asn = {
        "1234" = "BGP 1"
        "2345" = "BGP 2"
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant