Actions
Bug #22650
openException raised cause error 500 for accept new node from API
Pull Request:
Severity:
Minor - inconvenience | misleading | easy workaround
UX impact:
I hate Rudder for that
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
To do
Regression:
No
Description
How the problem occurs:
It seems like when we auto accept new node from hook, the acceptation succeed but the API respond with an error 500. It seems like it's cause by datasource plugin when the option "Update when a new node is accepted" is activated, when we use a property in the node for the URL, this raised an exception, and this is bad:
[2023-04-18 16:37:43+0200] ERROR net.liftweb.http.LiftRules - Exception being returned to browser when processing /api/latest/nodes/pending/2d996c08-2e10-1c38-mc1c-114p278358a3 java.lang.RuntimeException: Error when getting data from datasource 'test_datasource' for node agent1.local.server (2d996c08-2e10-1c38-mc1c-114p278358a3):; cause was: Error when trying to parse URL https://localhost:8786/v1/service?test_property=${node.properties[test]}; cause was: Unexpected: Missing property '${node.properties[test]}' on node 'agent1.local.server' [2d996c08-2e10-1c38-mc1c-114p278358a3] at com.normation.zio$ZioRuntime$.$anonfun$runNow$3(ZioCommons.scala:418) at scala.Option.map(Option.scala:242) at zio.Cause.squashWith(Cause.scala:400) at com.normation.zio$ZioRuntime$.$anonfun$runNow$2(ZioCommons.scala:418) at zio.Exit.fold(Exit.scala:98) at com.normation.zio$ZioRuntime$.runNow(ZioCommons.scala:418) at com.normation.zio$UnsafeRun.runNow(ZioCommons.scala:440) at bootstrap.rudder.plugin.DatasourcesConf$$anon$2.afterNodeAcceptedAsync(DataSourcesConf.scala:108)
Actions