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.
This commit is contained in:
parent
8193b689ed
commit
e642336780
|
|
@ -1128,9 +1128,8 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
|||
target = null;
|
||||
if (
|
||||
response.statusCode == 422 &&
|
||||
JSON.stringify(response.body).includes(
|
||||
"Target name already exists"
|
||||
)
|
||||
JSON.stringify(response.body)
|
||||
.match(/Target(.*)name already exists/g)?.length > 0
|
||||
) {
|
||||
target = await httpApiClient.findResourceByProperties(
|
||||
"/iscsi/target",
|
||||
|
|
|
|||
|
|
@ -1205,9 +1205,8 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
|
|||
target = null;
|
||||
if (
|
||||
response.statusCode == 422 &&
|
||||
JSON.stringify(response.body).includes(
|
||||
"Target name already exists"
|
||||
)
|
||||
JSON.stringify(response.body)
|
||||
.match(/Target(.*)name already exists/g)?.length > 0
|
||||
) {
|
||||
target = await this.findResourceByProperties(
|
||||
"/iscsi/target",
|
||||
|
|
|
|||
Loading…
Reference in New Issue