Icinga / icingaweb2-module-director

The Director aims to be your new favourite Icinga config deployment tool. Director is designed for those who want to automate their configuration deployment and those who want to grant their “point & click” users easy access to the configuration.
https://icinga.com/docs/director/latest
GNU General Public License v2.0
413 stars 203 forks source link

REST-API behavior inconsistent regarding URL enconding #2829

Open log1-c opened 1 year ago

log1-c commented 1 year ago

We are currently using the Ansible Icinga Director modules by Telekom-MMS. While creating a hostgroup with multiple assign conditions I stumble over problems with URL encoding.

Having multiple conditions does work like this

director/hostgroup?name=q1poc -X POST -d '{"assign_filter": "host.vars.hostgroup=\"q1poc\"|host.vars.tags.customer=\"q1poc\"", "object_type": "object", "object_name": "q1poc"}'

image

{
    "assign_filter": "host.vars.hostgroup=\"q1poc\"|host.vars.tags.customer=\"q1poc\"",
    "object_name": "q1poc",
    "object_type": "object"
}

but not with URL-encoding

/director/hostgroup?name=q1poc -X POST -d '{"assign_filter": "host.vars.hostgroup=%22q1poc%22%7Chost.vars.tags.customer=%22q1poc%22", "object_type": "object", "object_name": "q1poc"}'

image

{
    "assign_filter": "host.vars.hostgroup=%22q1poc%22%7Chost.vars.tags.customer=%22q1poc%22",
    "object_name": "q1poc",
    "object_type": "object"
}

while with a single condition it doesn't care about the URL encoding

/director/hostgroup?name=q1poc -X POST -d '{"assign_filter": "host.vars.hostgroup=%22q1poc%22", "object_type": "object", "object_name": "q1poc"}'

image

{
    "assign_filter": "host.vars.hostgroup=%22q1poc%22",
    "object_name": "q1poc",
    "object_type": "object",
    "uuid": "5cd672fb-71e4-4c9d-93ae-da57c5491976"
}

This seems inconsistent and like a bug to me.

Your Environment