> On 01 Dec 2015, at 13:37, Christian Moreno Moreno > <[email protected]> wrote: > > Hi! > > We are testing the new API and I can create new hosts, hostgroups, etc > without problem. But if I try to modify the groups of one host, then I get > one error: > > > curl -k -s -H 'Accept: application/json' -u root:xxx > 'https://icinga2-dev-01.ipx:5665/v1/objects/hosts/test15' -X POST -d '{ > "templates": [ "generic-host" ], "attrs": { "groups" : [ "all","ipx"] }}' > |python -m json.tool > { > "results": [ > { > "code": 500.0, > "name": "test15", > "status": "Attribute 'groups' could not be set: Error: Attribute > cannot be modified.\n\n\t(0) libbase.so: void > boost::throw_exception<boost::exception_detail::error_info_injector<std::invalid_argument> > >(boost::exception_detail::error_info_injector<std::invalid_argument> > const&) (+0x4a) [0x2b982a4630aa]\n\t(1) libbase.so: void > boost::exception_detail::throw_exception_<std::invalid_argument>(std::invalid_argument > const&, char const*, char const*, int) (+0x54) [0x2b982a463124]\n\t(2) > libbase.so: icinga::ConfigObject::ModifyAttribute(icinga::String const&, > icinga::Value const&, bool) (+0x1803) [0x2b982a41cd73]\n\t(3) libremote.so: > icinga::ModifyObjectHandler::HandleRequest(boost::intrusive_ptr<icinga::ApiUser> > const&, icinga::HttpRequest&, icinga::HttpResponse&) (+0x7e0) > [0x2b982ae78ee0]\n\t(4) libremote.so: > icinga::HttpHandler::ProcessRequest(boost::intrusive_ptr<icinga::ApiUser> > const&, icinga::HttpRequest&, icinga::HttpResponse&) (+0x6f7) > [0x2b982ae5bbd7]\n\t(5) libremote.so: > icinga::HttpServerConnection::ProcessMessageAsync(icinga::HttpRequest&) > (+0x433) [0x2b982ae86043]\n\t(6) libbase.so: > icinga::WorkQueue::WorkerThreadProc() (+0x23c) [0x2b982a40330c]\n\t(7) > libboost_thread.so.1.49.0: <unknown function> (+0x10629) > [0x2b9829d31629]\n\t(8) libpthread.so.0: <unknown function> (+0x6b50) > [0x2b9829f21b50]\n\t(9) libc.so.6: clone (+0x6d) [0x2b982cc5895d]\n\n", > "type": "Host" > } > ] > } > > I dont have any problem with the rest of the attributes, for example: > > curl -k -s -H 'Accept: application/json' -u root:xxxx > 'https://icinga2-dev-01.ipx:5665/v1/objects/hosts/test15' -X POST -d '{ > "templates": [ "generic-host" ], "attrs": { "address": "127.2.222.1" }}' > |python -m json.tool > { > "results": [ > { > "code": 200.0, > "name": "test15", > "status": "Attributes updated.", > "type": "Host" > } > ] > } > > How can I change the Groups of one host??
That’s by design as it involves changes in group membership assignments. You cannot modify (POST) the groups attribute similar to changing the “templates” attribute. Kind regards, Michael > > Cheers, > > > Christian Moreno Moreno > System Engineer Offers > > idealo internet GmbH > Ritterstraße 11 > 10969 Berlin, Deutschland > Tel.: +49 (0)30 40 30 10 33 > Fax: +49 (0)30 221 94 33 - 21 > E-Mail: [email protected] > Geschäftsführer: > Dr. Albrecht von Sonntag, Dr. Philipp-Christopher Peitsch > HRB 76749 – Amtsgericht Berlin-Charlottenburg > > > > > > _______________________________________________ > icinga-users mailing list > [email protected] > https://lists.icinga.org/mailman/listinfo/icinga-users -- Michael Friedrich, DI (FH) Senior Developer NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg Tel: +49 911 92885-0 | Fax: +49 911 92885-77 GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 http://www.netways.de | [email protected] ** OSDC 2016 - April - netways.de/osdc ** ** OSBConf 2016 - September - osbconf.org ** _______________________________________________ icinga-users mailing list [email protected] https://lists.icinga.org/mailman/listinfo/icinga-users
