Open chicco785 opened 4 years ago
As far as I understand IOTAManager is responsing with 500 to IOTA under this circustance.
What do you think expected behavior should be? Responding with 400 with a more specific cause?
shouldn't be the configuration overwritten? who is the latest source of "correct" configuration?
shouldn't be the configuration overwritten?
That's an option, for sure. But maybe it's safer delete + create instead of overwrite.
sure, but when the iot agent starts and send the command, is doing it automatically, so either the logic in the iot-agentlib is changed (delete and recreate), or the logic on iot agent manager overwrite existing services
Looking again to the trace, which operation is the one which is failing? POST /iot/protocols
?
yes, correct
"url": "http://iot-agent-manager-iot-agent-manager:8082/iot/protocols",
and the part generating issue should be the services
since then the issue are the conflicting apikeys
Looking to the index that is causing the duplicated key error at MongoDB:
apikey_1_resource_1_protocol_1
it seems it doesn't have to do with services alone, but with the combination of apikey (which comes from sercice) + resource + protocol.
I think is a good idea not allowing two IOTAs register the same apikey+resource+protocol combination. And, in the case of IOTAManager getting a registration attempt on an existing apikey+resource+protocol is probably due to some misconfiguration of the IOTA (which, at least should use a different apikey). In that case, it seems better to report an error (in the form of 400 response) than overriding, so the admin can be aware of the situation and fix the conflicting IOTA configuration.
concrete use case:
this means that configuration recovery will never work toward iot agent manager, unless you first delete everything.
when iot agent tries to register services (already existing):
IoT agent managers reports: