Skip to content

Commit

Permalink
Netscaler: remove previous archive
Browse files Browse the repository at this point in the history
  • Loading branch information
SCadilhac committed Apr 18, 2024
1 parent 74533a6 commit f9f2866
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/main/resources/drivers/Citrix_Netscaler.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var Info = {
name: "CitrixNetscaler",
description: "Citrix NetScaler",
author: "NetFishers",
version: "2.0"
version: "2.1"
};

var Config = {
Expand Down Expand Up @@ -92,7 +92,7 @@ var CLI = {
},
cli: {
prompt: /^([^\s\r\n]*( \((Primary|Secondary)\))?> )$/,
error: /^ERROR: /m,
error: /^ERROR: (.*)/m,
pager: {
avoid: "set cli mode -page OFF",
match: /^.--More--/,
Expand Down Expand Up @@ -321,6 +321,18 @@ function snapshot(cli, device, config) {
}
config.set("runningConfig", runningConfig);

// Delete any legacy backup archive
try {
cli.command("rm system backup netshot.tgz");
}
catch (e) {
if (String(e).match(/Backup file does not exist/)) {
// ignore
}
else {
throw e;
}
}
// Create a backup archive
const backupOutput = cli.command("create system backup -level full netshot");
if (!backupOutput.match(/Done/)) {
Expand All @@ -334,7 +346,7 @@ function snapshot(cli, device, config) {
throw e;
}
finally {
cli.command("rm system backup netshot.tgz")
cli.command("rm system backup netshot.tgz");
}
};

Expand Down

0 comments on commit f9f2866

Please sign in to comment.