diff --git a/ci/diff.py b/ci/diff.py index 50c0dedd..6a0a7edf 100644 --- a/ci/diff.py +++ b/ci/diff.py @@ -10,7 +10,7 @@ r"\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:[+-]\d{2}:\d{2})?|\d{4}-\d{2}-\d{2}" ) datetime_str_pattern = re.compile( - r"\b[A-Za-z]{3}\s[A-Za-z]{3}\s([0-2]?[0-9]|3[0-1])\s([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])\s[0-9]{4}\b" + r"\b[A-Za-z]{3}\s[A-Za-z]{3}\s+([0-2]?[0-9]|3[0-1])\s([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])\s[0-9]{4}\b" ) # datetime_str_pattern = re.compile( # r"\b(Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s([0-2]?[0-9]|3[0-1])\s([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])\s[0-9]{4}\b" diff --git a/ci/testsuite-result.json b/ci/testsuite-result.json index 3045405e..3e57384a 100644 --- a/ci/testsuite-result.json +++ b/ci/testsuite-result.json @@ -11863,7 +11863,7 @@ "command_filter_negate": false, "command_issued": "group create mygroup \"This describes the group\"", "ok": [ - "OK: : Created new group 'mygroup'" + "Created new group mygroup" ], "warning": [], "error": [], @@ -11871,14 +11871,11 @@ "api_requests": [ { "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", + "url": "/api/v1/hostgroups/mygroup", "data": {}, - "status": 200, + "status": 404, "response": { - "count": 0, - "next": null, - "previous": null, - "results": [] + "detail": "Not found." } }, { @@ -11889,6 +11886,20 @@ "description": "This describes the group" }, "status": 201 + }, + { + "method": "GET", + "url": "/api/v1/hostgroups/mygroup", + "data": {}, + "status": 200, + "response": { + "parent": [], + "groups": [], + "hosts": [], + "owners": [], + "name": "mygroup", + "description": "This describes the group" + } } ], "time": null @@ -11899,24 +11910,35 @@ "command_filter_negate": false, "command_issued": "host add testhost1", "ok": [ - "OK: : created host testhost1.example.org" - ], - "warning": [ - "WARNING: : host not found: testhost1.example.org" + "Created host testhost1.example.org" ], + "warning": [], "error": [], - "output": [], + "output": [ + "Name: testhost1.example.org", + "Contact: ", + "TTL: (Default)", + "TXT: v=spf1 -all", + "Created: Wed Jun 5 11:30:33 2024", + "Updated: Wed Jun 5 11:30:33 2024" + ], "api_requests": [ { "method": "GET", - "url": "/api/v1/hosts/?name=testhost1.example.org", + "url": "/api/v1/hosts/testhost1.example.org", "data": {}, - "status": 200, + "status": 404, "response": { - "count": 0, - "next": null, - "previous": null, - "results": [] + "detail": "Not found." + } + }, + { + "method": "GET", + "url": "/api/v1/cnames/testhost1.example.org", + "data": {}, + "status": 404, + "response": { + "detail": "Not found." } }, { @@ -11944,9 +11966,43 @@ } } }, + { + "method": "POST", + "url": "/api/v1/hosts/", + "data": { + "name": "testhost1.example.org" + }, + "status": 201 + }, + { + "method": "GET", + "url": "/api/v1/hosts/testhost1.example.org", + "data": {}, + "status": 200, + "response": { + "ipaddresses": [], + "cnames": [], + "mxs": [], + "txts": [ + { + "txt": "v=spf1 -all", + "host": 7 + } + ], + "ptr_overrides": [], + "hinfo": null, + "loc": null, + "bacnetid": null, + "name": "testhost1.example.org", + "contact": "", + "ttl": null, + "comment": "", + "zone": 1 + } + }, { "method": "GET", - "url": "/api/v1/cnames/?name=testhost1.example.org", + "url": "/api/v1/srvs/?host=7", "data": {}, "status": 200, "response": { @@ -11957,14 +12013,52 @@ } }, { - "method": "POST", - "url": "/api/v1/hosts/", - "data": { - "name": "testhost1.example.org", - "contact": null, - "comment": null - }, - "status": 201 + "method": "GET", + "url": "/api/v1/naptrs/?host=7", + "data": {}, + "status": 200, + "response": { + "count": 0, + "next": null, + "previous": null, + "results": [] + } + }, + { + "method": "GET", + "url": "/api/v1/sshfps/?host=7", + "data": {}, + "status": 200, + "response": { + "count": 0, + "next": null, + "previous": null, + "results": [] + } + }, + { + "method": "GET", + "url": "/api/v1/hostpolicy/roles/?hosts=7", + "data": {}, + "status": 200, + "response": { + "count": 0, + "next": null, + "previous": null, + "results": [] + } + }, + { + "method": "GET", + "url": "/api/v1/hostgroups/?hosts=7", + "data": {}, + "status": 200, + "response": { + "count": 0, + "next": null, + "previous": null, + "results": [] + } } ], "time": null @@ -11975,24 +12069,35 @@ "command_filter_negate": false, "command_issued": "host add testhost2", "ok": [ - "OK: : created host testhost2.example.org" - ], - "warning": [ - "WARNING: : host not found: testhost2.example.org" + "Created host testhost2.example.org" ], + "warning": [], "error": [], - "output": [], + "output": [ + "Name: testhost2.example.org", + "Contact: ", + "TTL: (Default)", + "TXT: v=spf1 -all", + "Created: Wed Jun 5 11:30:33 2024", + "Updated: Wed Jun 5 11:30:33 2024" + ], "api_requests": [ { "method": "GET", - "url": "/api/v1/hosts/?name=testhost2.example.org", + "url": "/api/v1/hosts/testhost2.example.org", "data": {}, - "status": 200, + "status": 404, "response": { - "count": 0, - "next": null, - "previous": null, - "results": [] + "detail": "Not found." + } + }, + { + "method": "GET", + "url": "/api/v1/cnames/testhost2.example.org", + "data": {}, + "status": 404, + "response": { + "detail": "Not found." } }, { @@ -12020,9 +12125,43 @@ } } }, + { + "method": "POST", + "url": "/api/v1/hosts/", + "data": { + "name": "testhost2.example.org" + }, + "status": 201 + }, { "method": "GET", - "url": "/api/v1/cnames/?name=testhost2.example.org", + "url": "/api/v1/hosts/testhost2.example.org", + "data": {}, + "status": 200, + "response": { + "ipaddresses": [], + "cnames": [], + "mxs": [], + "txts": [ + { + "txt": "v=spf1 -all", + "host": 8 + } + ], + "ptr_overrides": [], + "hinfo": null, + "loc": null, + "bacnetid": null, + "name": "testhost2.example.org", + "contact": "", + "ttl": null, + "comment": "", + "zone": 1 + } + }, + { + "method": "GET", + "url": "/api/v1/srvs/?host=8", "data": {}, "status": 200, "response": { @@ -12033,14 +12172,52 @@ } }, { - "method": "POST", - "url": "/api/v1/hosts/", - "data": { - "name": "testhost2.example.org", - "contact": null, - "comment": null - }, - "status": 201 + "method": "GET", + "url": "/api/v1/naptrs/?host=8", + "data": {}, + "status": 200, + "response": { + "count": 0, + "next": null, + "previous": null, + "results": [] + } + }, + { + "method": "GET", + "url": "/api/v1/sshfps/?host=8", + "data": {}, + "status": 200, + "response": { + "count": 0, + "next": null, + "previous": null, + "results": [] + } + }, + { + "method": "GET", + "url": "/api/v1/hostpolicy/roles/?hosts=8", + "data": {}, + "status": 200, + "response": { + "count": 0, + "next": null, + "previous": null, + "results": [] + } + }, + { + "method": "GET", + "url": "/api/v1/hostgroups/?hosts=8", + "data": {}, + "status": 200, + "response": { + "count": 0, + "next": null, + "previous": null, + "results": [] + } } ], "time": null @@ -12051,7 +12228,7 @@ "command_filter_negate": false, "command_issued": "group host_add mygroup testhost1", "ok": [ - "OK: : Added host 'testhost1.example.org' to 'mygroup'" + "Added host 'testhost1.example.org' to 'mygroup'" ], "warning": [], "error": [], @@ -12059,23 +12236,16 @@ "api_requests": [ { "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", + "url": "/api/v1/hostgroups/mygroup", "data": {}, "status": 200, "response": { - "count": 1, - "next": null, - "previous": null, - "results": [ - { - "parent": [], - "groups": [], - "hosts": [], - "owners": [], - "name": "mygroup", - "description": "This describes the group" - } - ] + "parent": [], + "groups": [], + "hosts": [], + "owners": [], + "name": "mygroup", + "description": "This describes the group" } }, { @@ -12090,7 +12260,7 @@ "txts": [ { "txt": "v=spf1 -all", - "host": 9 + "host": 7 } ], "ptr_overrides": [], @@ -12111,25 +12281,10 @@ "name": "testhost1.example.org" }, "status": 201 - } - ], - "time": null - }, - { - "command": "group host_add mygroup testhost2", - "command_filter": null, - "command_filter_negate": false, - "command_issued": "group host_add mygroup testhost2", - "ok": [ - "OK: : Added host 'testhost2.example.org' to 'mygroup'" - ], - "warning": [], - "error": [], - "output": [], - "api_requests": [ + }, { "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", + "url": "/api/v1/hostgroups/?id=1", "data": {}, "status": 200, "response": { @@ -12151,6 +12306,39 @@ } ] } + } + ], + "time": null + }, + { + "command": "group host_add mygroup testhost2", + "command_filter": null, + "command_filter_negate": false, + "command_issued": "group host_add mygroup testhost2", + "ok": [ + "Added host 'testhost2.example.org' to 'mygroup'" + ], + "warning": [], + "error": [], + "output": [], + "api_requests": [ + { + "method": "GET", + "url": "/api/v1/hostgroups/mygroup", + "data": {}, + "status": 200, + "response": { + "parent": [], + "groups": [], + "hosts": [ + { + "name": "testhost1.example.org" + } + ], + "owners": [], + "name": "mygroup", + "description": "This describes the group" + } }, { "method": "GET", @@ -12164,7 +12352,7 @@ "txts": [ { "txt": "v=spf1 -all", - "host": 10 + "host": 8 } ], "ptr_overrides": [], @@ -12185,25 +12373,10 @@ "name": "testhost2.example.org" }, "status": 201 - } - ], - "time": null - }, - { - "command": "group owner_add mygroup myself", - "command_filter": null, - "command_filter_negate": false, - "command_issued": "group owner_add mygroup myself", - "ok": [ - "OK: : Added 'myself' as owner of 'mygroup'" - ], - "warning": [], - "error": [], - "output": [], - "api_requests": [ + }, { "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", + "url": "/api/v1/hostgroups/?id=1", "data": {}, "status": 200, "response": { @@ -12228,25 +12401,17 @@ } ] } - }, - { - "method": "POST", - "url": "/api/v1/hostgroups/mygroup/owners/", - "data": { - "name": "myself" - }, - "status": 201 } ], "time": null }, { - "command": "group host_remove mygroup testhost2", + "command": "group owner_add mygroup myself", "command_filter": null, "command_filter_negate": false, - "command_issued": "group host_remove mygroup testhost2", + "command_issued": "group owner_add mygroup myself", "ok": [ - "OK: : Removed host 'testhost2.example.org' from 'mygroup'" + "Added owner 'myself' to 'mygroup'" ], "warning": [], "error": [], @@ -12254,7 +12419,36 @@ "api_requests": [ { "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", + "url": "/api/v1/hostgroups/mygroup", + "data": {}, + "status": 200, + "response": { + "parent": [], + "groups": [], + "hosts": [ + { + "name": "testhost1.example.org" + }, + { + "name": "testhost2.example.org" + } + ], + "owners": [], + "name": "mygroup", + "description": "This describes the group" + } + }, + { + "method": "POST", + "url": "/api/v1/hostgroups/mygroup/owners/", + "data": { + "name": "myself" + }, + "status": 201 + }, + { + "method": "GET", + "url": "/api/v1/hostgroups/?id=1", "data": {}, "status": 200, "response": { @@ -12283,6 +12477,46 @@ } ] } + } + ], + "time": null + }, + { + "command": "group host_remove mygroup testhost2", + "command_filter": null, + "command_filter_negate": false, + "command_issued": "group host_remove mygroup testhost2", + "ok": [ + "Removed host 'testhost2.example.org' from 'mygroup'" + ], + "warning": [], + "error": [], + "output": [], + "api_requests": [ + { + "method": "GET", + "url": "/api/v1/hostgroups/mygroup", + "data": {}, + "status": 200, + "response": { + "parent": [], + "groups": [], + "hosts": [ + { + "name": "testhost1.example.org" + }, + { + "name": "testhost2.example.org" + } + ], + "owners": [ + { + "name": "myself" + } + ], + "name": "mygroup", + "description": "This describes the group" + } }, { "method": "GET", @@ -12296,7 +12530,7 @@ "txts": [ { "txt": "v=spf1 -all", - "host": 10 + "host": 8 } ], "ptr_overrides": [], @@ -12315,28 +12549,10 @@ "url": "/api/v1/hostgroups/mygroup/hosts/testhost2.example.org", "data": {}, "status": 204 - } - ], - "time": null - }, - { - "command": "group info mygroup", - "command_filter": null, - "command_filter_negate": false, - "command_issued": "group info mygroup", - "ok": [], - "warning": [], - "error": [], - "output": [ - "Name: mygroup", - "Description: This describes the group", - "Members: 1 host", - "Owners: myself" - ], - "api_requests": [ + }, { "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", + "url": "/api/v1/hostgroups/?id=1", "data": {}, "status": 200, "response": { @@ -12366,6 +12582,50 @@ ], "time": null }, + { + "command": "group info mygroup", + "command_filter": null, + "command_filter_negate": false, + "command_issued": "group info mygroup", + "ok": [], + "warning": [], + "error": [], + "output": [ + "Name: mygroup", + "Description: This describes the group", + "Owners: myself", + "Parents: ", + "Groups: ", + "Hosts: 1", + "Created: Wed Jun 5 11:30:32 2024", + "Updated: Wed Jun 5 11:30:34 2024" + ], + "api_requests": [ + { + "method": "GET", + "url": "/api/v1/hostgroups/mygroup", + "data": {}, + "status": 200, + "response": { + "parent": [], + "groups": [], + "hosts": [ + { + "name": "testhost1.example.org" + } + ], + "owners": [ + { + "name": "myself" + } + ], + "name": "mygroup", + "description": "This describes the group" + } + } + ], + "time": null + }, { "command": "group history mygroup", "command_filter": null, @@ -12553,7 +12813,7 @@ "command_filter_negate": false, "command_issued": "group create yourgroup \"meh\"", "ok": [ - "OK: : Created new group 'yourgroup'" + "Created new group yourgroup" ], "warning": [], "error": [], @@ -12561,14 +12821,11 @@ "api_requests": [ { "method": "GET", - "url": "/api/v1/hostgroups/?name=yourgroup", + "url": "/api/v1/hostgroups/yourgroup", "data": {}, - "status": 200, + "status": 404, "response": { - "count": 0, - "next": null, - "previous": null, - "results": [] + "detail": "Not found." } }, { @@ -12579,7 +12836,21 @@ "description": "meh" }, "status": 201 - } + }, + { + "method": "GET", + "url": "/api/v1/hostgroups/yourgroup", + "data": {}, + "status": 200, + "response": { + "parent": [], + "groups": [], + "hosts": [], + "owners": [], + "name": "yourgroup", + "description": "meh" + } + } ], "time": null }, @@ -12589,60 +12860,46 @@ "command_filter_negate": false, "command_issued": "group group_add mygroup yourgroup", "ok": [ - "OK: : Added group 'yourgroup' to 'mygroup'" + "Added group 'yourgroup' to 'mygroup'" ], - "warning": [], - "error": [], - "output": [], - "api_requests": [ - { - "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", - "data": {}, - "status": 200, - "response": { - "count": 1, - "next": null, - "previous": null, - "results": [ - { - "parent": [], - "groups": [], - "hosts": [ - { - "name": "testhost1.example.org" - } - ], - "owners": [ - { - "name": "myself" - } - ], - "name": "mygroup", - "description": "This describes the group" - } - ] + "warning": [], + "error": [], + "output": [], + "api_requests": [ + { + "method": "GET", + "url": "/api/v1/hostgroups/yourgroup", + "data": {}, + "status": 200, + "response": { + "parent": [], + "groups": [], + "hosts": [], + "owners": [], + "name": "yourgroup", + "description": "meh" } }, { "method": "GET", - "url": "/api/v1/hostgroups/?name=yourgroup", + "url": "/api/v1/hostgroups/mygroup", "data": {}, "status": 200, "response": { - "count": 1, - "next": null, - "previous": null, - "results": [ + "parent": [], + "groups": [], + "hosts": [ { - "parent": [], - "groups": [], - "hosts": [], - "owners": [], - "name": "yourgroup", - "description": "meh" + "name": "testhost1.example.org" } - ] + ], + "owners": [ + { + "name": "myself" + } + ], + "name": "mygroup", + "description": "This describes the group" } }, { @@ -12652,28 +12909,10 @@ "name": "yourgroup" }, "status": 201 - } - ], - "time": null - }, - { - "command": "group info mygroup", - "command_filter": null, - "command_filter_negate": false, - "command_issued": "group info mygroup", - "ok": [], - "warning": [], - "error": [], - "output": [ - "Name: mygroup", - "Description: This describes the group", - "Members: 1 host, 1 group", - "Owners: myself" - ], - "api_requests": [ + }, { "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", + "url": "/api/v1/hostgroups/?id=1", "data": {}, "status": 200, "response": { @@ -12707,13 +12946,61 @@ ], "time": null }, + { + "command": "group info mygroup", + "command_filter": null, + "command_filter_negate": false, + "command_issued": "group info mygroup", + "ok": [], + "warning": [], + "error": [], + "output": [ + "Name: mygroup", + "Description: This describes the group", + "Owners: myself", + "Parents: ", + "Groups: yourgroup", + "Hosts: 1", + "Created: Wed Jun 5 15:40:45 2024", + "Updated: Wed Jun 5 15:40:47 2024" + ], + "api_requests": [ + { + "method": "GET", + "url": "/api/v1/hostgroups/mygroup", + "data": {}, + "status": 200, + "response": { + "parent": [], + "groups": [ + { + "name": "yourgroup" + } + ], + "hosts": [ + { + "name": "testhost1.example.org" + } + ], + "owners": [ + { + "name": "myself" + } + ], + "name": "mygroup", + "description": "This describes the group" + } + } + ], + "time": null + }, { "command": "group group_remove mygroup yourgroup", "command_filter": null, "command_filter_negate": false, "command_issued": "group group_remove mygroup yourgroup", "ok": [ - "OK: : Removed group 'yourgroup' from 'mygroup'" + "Removed group 'yourgroup' from 'mygroup'" ], "warning": [], "error": [], @@ -12721,7 +13008,39 @@ "api_requests": [ { "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", + "url": "/api/v1/hostgroups/mygroup", + "data": {}, + "status": 200, + "response": { + "parent": [], + "groups": [ + { + "name": "yourgroup" + } + ], + "hosts": [ + { + "name": "testhost1.example.org" + } + ], + "owners": [ + { + "name": "myself" + } + ], + "name": "mygroup", + "description": "This describes the group" + } + }, + { + "method": "DELETE", + "url": "/api/v1/hostgroups/mygroup/groups/yourgroup", + "data": {}, + "status": 204 + }, + { + "method": "GET", + "url": "/api/v1/hostgroups/?id=1", "data": {}, "status": 200, "response": { @@ -12731,11 +13050,7 @@ "results": [ { "parent": [], - "groups": [ - { - "name": "yourgroup" - } - ], + "groups": [], "hosts": [ { "name": "testhost1.example.org" @@ -12751,12 +13066,6 @@ } ] } - }, - { - "method": "DELETE", - "url": "/api/v1/hostgroups/mygroup/groups/yourgroup", - "data": {}, - "status": 204 } ], "time": null @@ -12767,7 +13076,7 @@ "command_filter_negate": false, "command_issued": "group owner_add mygroup anotherowner", "ok": [ - "OK: : Added 'anotherowner' as owner of 'mygroup'" + "Added owner 'anotherowner' to 'mygroup'" ], "warning": [], "error": [], @@ -12775,7 +13084,37 @@ "api_requests": [ { "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", + "url": "/api/v1/hostgroups/mygroup", + "data": {}, + "status": 200, + "response": { + "parent": [], + "groups": [], + "hosts": [ + { + "name": "testhost1.example.org" + } + ], + "owners": [ + { + "name": "myself" + } + ], + "name": "mygroup", + "description": "This describes the group" + } + }, + { + "method": "POST", + "url": "/api/v1/hostgroups/mygroup/owners/", + "data": { + "name": "anotherowner" + }, + "status": 201 + }, + { + "method": "GET", + "url": "/api/v1/hostgroups/?id=1", "data": {}, "status": 200, "response": { @@ -12792,6 +13131,9 @@ } ], "owners": [ + { + "name": "anotherowner" + }, { "name": "myself" } @@ -12801,14 +13143,6 @@ } ] } - }, - { - "method": "POST", - "url": "/api/v1/hostgroups/mygroup/owners/", - "data": { - "name": "anotherowner" - }, - "status": 201 } ], "time": null @@ -12819,7 +13153,7 @@ "command_filter_negate": false, "command_issued": "group owner_remove mygroup myself", "ok": [ - "OK: : Removed 'myself' as owner of 'mygroup'" + "Removed owner 'myself' from 'mygroup'" ], "warning": [], "error": [], @@ -12827,7 +13161,38 @@ "api_requests": [ { "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", + "url": "/api/v1/hostgroups/mygroup", + "data": {}, + "status": 200, + "response": { + "parent": [], + "groups": [], + "hosts": [ + { + "name": "testhost1.example.org" + } + ], + "owners": [ + { + "name": "anotherowner" + }, + { + "name": "myself" + } + ], + "name": "mygroup", + "description": "This describes the group" + } + }, + { + "method": "DELETE", + "url": "/api/v1/hostgroups/mygroup/owners/myself", + "data": {}, + "status": 204 + }, + { + "method": "GET", + "url": "/api/v1/hostgroups/?id=1", "data": {}, "status": 200, "response": { @@ -12846,9 +13211,6 @@ "owners": [ { "name": "anotherowner" - }, - { - "name": "myself" } ], "name": "mygroup", @@ -12856,12 +13218,6 @@ } ] } - }, - { - "method": "DELETE", - "url": "/api/v1/hostgroups/mygroup/owners/myself", - "data": {}, - "status": 204 } ], "time": null @@ -13161,39 +13517,32 @@ "command_filter_negate": false, "command_issued": "group delete mygroup # fails because the group contains testhost1, must force", "ok": [], - "warning": [], - "error": [ - "ERROR: : Group contains 1 host(s) and 0 group(s), must force" + "warning": [ + "Group contains hosts or groups, must force" ], + "error": [], "output": [], "api_requests": [ { "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", + "url": "/api/v1/hostgroups/mygroup", "data": {}, "status": 200, "response": { - "count": 1, - "next": null, - "previous": null, - "results": [ + "parent": [], + "groups": [], + "hosts": [ { - "parent": [], - "groups": [], - "hosts": [ - { - "name": "testhost1.example.org" - } - ], - "owners": [ - { - "name": "anotherowner" - } - ], - "name": "mygroup", - "description": "This describes the group" + "name": "testhost1.example.org" } - ] + ], + "owners": [ + { + "name": "anotherowner" + } + ], + "name": "mygroup", + "description": "This describes the group" } } ], @@ -13205,7 +13554,7 @@ "command_filter_negate": false, "command_issued": "group delete mygroup -force", "ok": [ - "OK: : Deleted group 'mygroup'" + "Deleted group 'mygroup'" ], "warning": [], "error": [], @@ -13213,31 +13562,24 @@ "api_requests": [ { "method": "GET", - "url": "/api/v1/hostgroups/?name=mygroup", + "url": "/api/v1/hostgroups/mygroup", "data": {}, "status": 200, "response": { - "count": 1, - "next": null, - "previous": null, - "results": [ + "parent": [], + "groups": [], + "hosts": [ { - "parent": [], - "groups": [], - "hosts": [ - { - "name": "testhost1.example.org" - } - ], - "owners": [ - { - "name": "anotherowner" - } - ], - "name": "mygroup", - "description": "This describes the group" + "name": "testhost1.example.org" } - ] + ], + "owners": [ + { + "name": "anotherowner" + } + ], + "name": "mygroup", + "description": "This describes the group" } }, { @@ -13255,7 +13597,7 @@ "command_filter_negate": false, "command_issued": "group delete yourgroup", "ok": [ - "OK: : Deleted group 'yourgroup'" + "Deleted group 'yourgroup'" ], "warning": [], "error": [], @@ -13263,23 +13605,16 @@ "api_requests": [ { "method": "GET", - "url": "/api/v1/hostgroups/?name=yourgroup", + "url": "/api/v1/hostgroups/yourgroup", "data": {}, "status": 200, "response": { - "count": 1, - "next": null, - "previous": null, - "results": [ - { - "parent": [], - "groups": [], - "hosts": [], - "owners": [], - "name": "yourgroup", - "description": "meh" - } - ] + "parent": [], + "groups": [], + "hosts": [], + "owners": [], + "name": "yourgroup", + "description": "meh" } }, { @@ -13297,7 +13632,7 @@ "command_filter_negate": false, "command_issued": "host remove testhost1", "ok": [ - "OK: : removed testhost1.example.org" + "removed testhost1.example.org" ], "warning": [], "error": [], @@ -13315,7 +13650,7 @@ "txts": [ { "txt": "v=spf1 -all", - "host": 9 + "host": 7 } ], "ptr_overrides": [], @@ -13331,7 +13666,7 @@ }, { "method": "GET", - "url": "/api/v1/naptrs/?host=9", + "url": "/api/v1/naptrs/?host=7", "data": {}, "status": 200, "response": { @@ -13343,7 +13678,7 @@ }, { "method": "GET", - "url": "/api/v1/srvs/?host__name=testhost1.example.org", + "url": "/api/v1/srvs/?host=7", "data": {}, "status": 200, "response": { @@ -13368,7 +13703,7 @@ "command_filter_negate": false, "command_issued": "host remove testhost2", "ok": [ - "OK: : removed testhost2.example.org" + "removed testhost2.example.org" ], "warning": [], "error": [], @@ -13386,7 +13721,7 @@ "txts": [ { "txt": "v=spf1 -all", - "host": 10 + "host": 8 } ], "ptr_overrides": [], @@ -13402,7 +13737,7 @@ }, { "method": "GET", - "url": "/api/v1/naptrs/?host=10", + "url": "/api/v1/naptrs/?host=8", "data": {}, "status": 200, "response": { @@ -13414,7 +13749,7 @@ }, { "method": "GET", - "url": "/api/v1/srvs/?host__name=testhost2.example.org", + "url": "/api/v1/srvs/?host=8", "data": {}, "status": 200, "response": { diff --git a/mreg_cli/api/history.py b/mreg_cli/api/history.py index b45792bc..80e70e1a 100644 --- a/mreg_cli/api/history.py +++ b/mreg_cli/api/history.py @@ -79,7 +79,9 @@ def msg(self, basename: str) -> str: action = self.action model = self.model if action in ("add", "remove"): - if self.name == basename: + if self.resource == "groups" and model in ("Host", "Group", "HostGroup"): + msg = self.data["name"] + elif self.name == basename: msg = self.name else: msg = self.resource + " " + self.name