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 #11065] Deleting an object via API does not disable it in DB IDO #3889

Closed
icinga-migration opened this issue Feb 1, 2016 · 5 comments
Labels
area/db-ido Database output blocker Blocks a release or needs immediate attention bug Something isn't working
Milestone

Comments

@icinga-migration
Copy link

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

Created by mfriedrich on 2016-02-01 17:47:25 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2016-02-05 11:37:58 +00:00)
Target Version: 2.4.2
Last Update: 2016-02-23 09:58:45 +00:00 (in Redmine)

Icinga Version: v2.4.1-158-ge6a972f
Backport?: Already backported
Include in Changelog: 1

michi@mbmif ~/coding/icinga $ curl -k -s -u root:icinga -H 'Accept: application/json' -X PUT 'https://localhost:5665/v1/objects/hosts/example.localdomain' \
> -d '{ "templates": [ "generic-host" ], "attrs": { "address": "192.168.1.1", "check_command": "hostalive", "vars.os" : "Linux" } }' \
> | python -m json.tool
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
michi@mbmif ~/coding/icinga $ curl -k -s -u root:icinga -H 'Accept: application/json' -X DELETE 'https://localhost:5665/v1/objects/hosts/example.localdomain?cascade=1'
{"results":[{"code":200.0,"name":"example.localdomain","status":"Object was deleted.","type":"Host"}]}michi@mbmif ~/coding/icinga $

MariaDB [icinga]> select * from icinga_objects where name1 like '%domain%'
    -> ;
+-----------+-------------+---------------+---------------------+-------+-----------+
| object_id | instance_id | objecttype_id | name1               | name2 | is_active |
+-----------+-------------+---------------+---------------------+-------+-----------+
|       263 |           1 |             1 | example.localdomain | NULL  |         1 |
|       264 |           1 |             2 | example.localdomain | ping4 |         1 |
|       265 |           1 |             2 | example.localdomain | ssh   |         1 |
+-----------+-------------+---------------+---------------------+-------+-----------+
3 rows in set (0.00 sec)

Changesets

2016-02-05 11:37:00 +00:00 by mfriedrich 4049cc0

Fix: Deleting an object via API does not disable it in DB IDO

fixes #11065

2016-02-23 08:43:41 +00:00 by mfriedrich 7cbe1c4

Fix: Deleting an object via API does not disable it in DB IDO

fixes #11065

Relations:

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-02-04 15:22:29 +00:00

  • Priority changed from Normal to High

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-02-04 16:13:13 +00:00

  • Relates set to 10891

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-02-05 11:36:29 +00:00

Found it. When ensuring to remove duplicated config updates we changed the DeactivateObject condition. When an object gets deleted we need to ensure that it is deactivated inside the database. It may happen that for some reason the dbActive flag is already set to false (was not enabled before) which will then cause the condition to fail and the object remains active.

michi@mbmif ~ $ curl -k -s -u root:icinga -H 'Accept: application/json' -X PUT 'https://localhost:5665/v1/objects/hosts/example.localdomain' -d '{ "templates": [ "generic-host" ], "attrs": { "address": "192.168.1.1", "check_command": "hostalive", "vars.os" : "Linux" } }' | python -m json.tool
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
michi@mbmif ~ $ curl -k -s -u root:icinga -H 'Accept: application/json' -X DELETE 'https://localhost:5665/v1/objects/hosts/example.localdomain?cascade=1'
{"results":[{"code":200.0,"name":"example.localdomain","status":"Object was deleted.","type":"Host"}]}michi@mbmif ~ $

MariaDB [icinga]>  select * from icinga_objects where name1 like '%domain%';
+-----------+-------------+---------------+---------------------+-------+-----------+
| object_id | instance_id | objecttype_id | name1               | name2 | is_active |
+-----------+-------------+---------------+---------------------+-------+-----------+
|       263 |           1 |             1 | example.localdomain | NULL  |         1 |
|       264 |           1 |             2 | example.localdomain | ping4 |         1 |
|       265 |           1 |             2 | example.localdomain | ssh   |         1 |
+-----------+-------------+---------------+---------------------+-------+-----------+
3 rows in set (0.00 sec)

MariaDB [icinga]>  select * from icinga_objects where name1 like '%domain%';
+-----------+-------------+---------------+---------------------+-------+-----------+
| object_id | instance_id | objecttype_id | name1               | name2 | is_active |
+-----------+-------------+---------------+---------------------+-------+-----------+
|       263 |           1 |             1 | example.localdomain | NULL  |         0 |
|       264 |           1 |             2 | example.localdomain | ping4 |         0 |
|       265 |           1 |             2 | example.localdomain | ssh   |         0 |
+-----------+-------------+---------------+---------------------+-------+-----------+
3 rows in set (0.00 sec)

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-02-05 11:37:58 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset 4049cc0.

@icinga-migration
Copy link
Author

Updated by gbeutner on 2016-02-23 09:58:45 +00:00

  • Backport? changed from Not yet backported to Already backported

@icinga-migration icinga-migration added blocker Blocks a release or needs immediate attention bug Something isn't working area/db-ido Database output labels Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.4.2 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/db-ido Database output blocker Blocks a release or needs immediate attention bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant