truenas-iscsi: error code has changed on target exists with 25.01
Updates target name existence check to use regex matching instead of includes, which is more robust.
This commit is contained in:
parent
8193b689ed
commit
c86df7762d
|
|
@ -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",
|
||||||
|
|
|
||||||
|
|
@ -1205,9 +1205,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",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue