Compare commits

...

2 Commits

Author SHA1 Message Date
Matthew Mckenzie a9b5b3ec28
Merge e642336780 into 55c36d62ff 2025-07-18 13:19:48 +10:00
Matthew Mckenzie e642336780 truenas-iscsi: error code has changed on target exists with 25.01
Updates target name existence check to use regex matching
instead of JSON stringify and includes, which is more robust.
2025-07-18 13:10:01 +10:00
2 changed files with 4 additions and 6 deletions

View File

@ -1128,9 +1128,8 @@ class FreeNASApiDriver extends CsiBaseDriver {
target = null; target = null;
if ( if (
response.statusCode == 422 && response.statusCode == 422 &&
JSON.stringify(response.body).includes( JSON.stringify(response.body)
"Target name already exists" .match(/Target(.*)name already exists/g)?.length > 0
)
) { ) {
target = await httpApiClient.findResourceByProperties( target = await httpApiClient.findResourceByProperties(
"/iscsi/target", "/iscsi/target",

View File

@ -1217,9 +1217,8 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
target = null; target = null;
if ( if (
response.statusCode == 422 && response.statusCode == 422 &&
JSON.stringify(response.body).includes( JSON.stringify(response.body)
"Target name already exists" .match(/Target(.*)name already exists/g)?.length > 0
)
) { ) {
target = await this.findResourceByProperties( target = await this.findResourceByProperties(
"/iscsi/target", "/iscsi/target",