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

API incorrectly returns modified for command objects and templates with arguments #2660

Closed
jensrudolf opened this issue Nov 15, 2022 · 4 comments
Assignees
Milestone

Comments

@jensrudolf
Copy link

jensrudolf commented Nov 15, 2022

Expected Behavior

Creating a command object or template with PUT and pushing the same object or template with POST should return in status code 304 (unmodified) as documented.

Current Behavior

API returns 200 upon object / template creation (PUT) but also 200 on update (POST) with the same object data and creates a modified activity in the web ui.

Possible Solution

Sorry, don't know.

Steps to Reproduce (for bugs)

Create new command object providing arguments parameter:

curl -v -X PUT -u "user:pass" -H "Accept: application/json" https://icinga.example.com/director/command -d '{"object_name": "testcmd", "object_type": "object", "methods_execute": "PluginCheck", "command": "cmd.sh", "arguments": { "--arg": "val" }}'
...
< HTTP/1.1 201 Created
...

Now update the object using the same data:

curl -v -X POST -u "user:pass" -H "Accept: application/json" https://icinga.example.com/icingaweb2/director/command?name=testcmd -d '{"object_name": "testcmd", "object_type": "object", "methods_execute": "PluginCheck", "command": "cmd.sh", "arguments": { "--arg": "val" }}'
...
< HTTP/1.1 200 OK
...

Status code 200 is returned and in the web UI a new activity is created showing that command testcmd was modified but without a diff. The exact same happens, when using template as object type.

Note that, when omitting arguments parameter completely in both API requests, POST request correctly returns 304.

This effectively breaks the usage of Ansible Collection for Icinga Director.

Your Environment

  • Director version (System - About): 1.10.2
  • Icinga Web 2 version and modules (System - About): 2.11.2
  • Icinga 2 version (icinga2 --version): 2.13.6
  • Operating System and version: Debian 11 (Bullseye)
  • Webserver, PHP versions: NGINX v1.18.0, PHP 7.4.33
@jensrudolf jensrudolf changed the title Director API incorrectly returns modified for command objects and templates with arguments API incorrectly returns modified for command objects and templates with arguments Nov 15, 2022
@capull0
Copy link

capull0 commented Dec 20, 2022

This also happens over the Director GUI, if you just store a command object, without changing something, you will see changes in the activity log, but without a Diff.
If you deploy the changes, the Deployment ID will remain the same.

This breaks our Puppet workflow over the API

@capull0
Copy link

capull0 commented Feb 24, 2023

any chances to classify this as bug?
I can't identify the real changes in the activity log, because of the command objects.

@Thomas-Gelf Thomas-Gelf added this to the next milestone Feb 24, 2023
@EugenFo
Copy link

EugenFo commented Apr 21, 2023

We have exactly the same issue. Additionally we have found out that the notification endpoint has also this issue.

@Thomas-Gelf Thomas-Gelf modified the milestones: next, v1.11.0 Apr 21, 2023
@Thomas-Gelf Thomas-Gelf self-assigned this Aug 21, 2023
@Thomas-Gelf
Copy link
Contributor

Thanks for reporting this. Could have been reproduced and has now been fixed.

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

No branches or pull requests

4 participants