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] tribe29.checkmk.host is not idempotent #58

Closed
xenorites opened this issue Jun 8, 2022 · 8 comments
Closed

[BUG] tribe29.checkmk.host is not idempotent #58

xenorites opened this issue Jun 8, 2022 · 8 comments
Assignees
Labels
bug Something isn't working needs-info Further information is requested upstream There is something upstream blocking this

Comments

@xenorites
Copy link

Describe the bug
When running the tribe29.checkmk.host for a host that already exists in check_mk (with state: present) the module returns an error.

Component Name
tribe29.checkmk.host

Ansible Version

ansible [core 2.12.5]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/xenorites/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/xenorites/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.4 (main, Mar 25 2022, 00:00:00) [GCC 12.0.1 20220308 (Red Hat 12.0.1-0)]
  jinja version = 3.0.3
  libyaml = True

Checkmk Version

2.0.0p25 (CRE)

Collection Version

0.3.3

Expected behavior
Ansible should return an "OK" status for idempotency.

Actual behavior
Ansible returns an error:

FAILED! => {"changed": false, "msg": "Error calling API. HTTP code 400. Details: b'{\"title\": \"Invalid move action\", \"status\": 400, \"detail\": \"The host is already part of the specified target folder\"}', "}
@xenorites xenorites added the bug Something isn't working label Jun 8, 2022
@robin-checkmk
Copy link
Member

robin-checkmk commented Jun 8, 2022

Thanks for reporting this!
This is probably a duplicate of #41.
Please test this with our 'devel' branch.
A release of the collection will happen in approx. two weeks.

@xenorites
Copy link
Author

I installed the devel collection using ansible-galaxy collection install git+https://github.com/tribe29/ansible-collection-tribe29.checkmk.git,devel --force, but the error message remains the exact same. Any way for me to confirm that it installed the collection from git? The version number remains the same, so it's hard to tell.

@robin-checkmk
Copy link
Member

HI @xenorites and thanks for your patience. What you did should work, but we released v0.4.0 yesterday, so you might want to check that one. If the issue then still persists, I will hand this over to a developer to take a look.

@robin-checkmk robin-checkmk added the needs-info Further information is requested label Jun 24, 2022
@xenorites
Copy link
Author

Confirmed, the error does remain the same at this point.

@robin-checkmk
Copy link
Member

Okay, thank you for testing again. I just received word, that some related bugs in Checkmk have been fixed, and the fixes will be present in Checkmk 2.1.0p5. This release is expected within two weeks, so I want to ask you again to check against that release once it is out. Thanks!

@robin-checkmk robin-checkmk added the upstream There is something upstream blocking this label Jun 30, 2022
@cmasopust
Copy link

cmasopust commented Jul 21, 2022

could not confirm that this bug is solved :(

I'm using check-mk version 2.1.0p6 and collection version 0.5.0 and the host module is still not idempotent, this time because of the leading slash...

@diademiemi
Copy link
Contributor

As a temporary solution you can add
failed_when: checkmk_agent_create_result.failed is true and "The host is already part of the specified target folder" not in checkmk_agent_create_result.msg to the task. This will make it not fail if the host is already created.

@robin-tribe29 The agent role has this line in main.yml, if a fix is implemented in the module itself this line will be redundant and should also be removed.

@lgetwan
Copy link
Contributor

lgetwan commented Sep 12, 2022

Fixed with #147

@lgetwan lgetwan closed this as completed Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-info Further information is requested upstream There is something upstream blocking this
Projects
None yet
Development

No branches or pull requests

5 participants