default freenas api version to 2

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
Travis Glenn Hansen 2024-03-05 01:31:28 -07:00
parent 98c55987ca
commit 536f954e0a
3 changed files with 18 additions and 5 deletions

View File

@ -119,9 +119,13 @@ class Api {
return 2; return 2;
} }
if (systemVersion.v1) {
return 1; return 1;
} }
return 2;
}
async getIsFreeNAS() { async getIsFreeNAS() {
const systemVersion = await this.getSystemVersion(); const systemVersion = await this.getSystemVersion();
let version; let version;

View File

@ -12,7 +12,7 @@ class Client {
// default to v1.0 for now // default to v1.0 for now
if (!this.options.apiVersion) { if (!this.options.apiVersion) {
this.options.apiVersion = 1; this.options.apiVersion = 2;
} }
} }
@ -131,7 +131,11 @@ class Client {
delete options.httpAgent; delete options.httpAgent;
delete options.httpsAgent; delete options.httpsAgent;
let duration = parseFloat((Math.round((_.get(response, 'duration', 0) + Number.EPSILON) * 100) / 100) / 1000).toFixed(2); let duration = parseFloat(
Math.round((_.get(response, "duration", 0) + Number.EPSILON) * 100) /
100 /
1000
).toFixed(2);
this.logger.debug("FREENAS HTTP REQUEST DETAILS: " + stringify(options)); this.logger.debug("FREENAS HTTP REQUEST DETAILS: " + stringify(options));
this.logger.debug("FREENAS HTTP REQUEST DURATION: " + duration + "s"); this.logger.debug("FREENAS HTTP REQUEST DURATION: " + duration + "s");
@ -140,7 +144,8 @@ class Client {
"FREENAS HTTP RESPONSE STATUS CODE: " + _.get(response, "statusCode", "") "FREENAS HTTP RESPONSE STATUS CODE: " + _.get(response, "statusCode", "")
); );
this.logger.debug( this.logger.debug(
"FREENAS HTTP RESPONSE HEADERS: " + stringify(_.get(response, "headers", "")) "FREENAS HTTP RESPONSE HEADERS: " +
stringify(_.get(response, "headers", ""))
); );
this.logger.debug("FREENAS HTTP RESPONSE BODY: " + stringify(body)); this.logger.debug("FREENAS HTTP RESPONSE BODY: " + stringify(body));
} }

View File

@ -2106,9 +2106,13 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
return 2; return 2;
} }
if (systemVersion.v1) {
return 1; return 1;
} }
return 2;
}
async getIsFreeNAS() { async getIsFreeNAS() {
const systemVersion = await this.getSystemVersion(); const systemVersion = await this.getSystemVersion();
let version; let version;