error in health polling fixed
This commit is contained in:
@@ -69,7 +69,7 @@ async function checkZvolAccess() {
|
|||||||
|
|
||||||
async function checkResticRepository() {
|
async function checkResticRepository() {
|
||||||
try {
|
try {
|
||||||
const result = await runRestic(['snapshots', '--json'], { ignoreExitCode: true });
|
const result = await runRestic(['--no-lock', 'snapshots', '--json'], { ignoreExitCode: true });
|
||||||
return checkValue(result.exitCode === 0, result.exitCode === 0 ? 'ok' : result.stderr.trim() || 'restic repository check failed');
|
return checkValue(result.exitCode === 0, result.exitCode === 0 ? 'ok' : result.stderr.trim() || 'restic repository check failed');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return checkValue(false, error.message);
|
return checkValue(false, error.message);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ snapshotsRouter.get('/:vmName/:snapshotId/files', async (req, res, next) => {
|
|||||||
try {
|
try {
|
||||||
const snapshot = await validateSnapshotForVm(req.params.vmName, req.params.snapshotId);
|
const snapshot = await validateSnapshotForVm(req.params.vmName, req.params.snapshotId);
|
||||||
assertSnapshotIdShape(snapshot.id);
|
assertSnapshotIdShape(snapshot.id);
|
||||||
const result = await runRestic(['ls', '--json', snapshot.id]);
|
const result = await runRestic(['--no-lock', 'ls', '--json', snapshot.id]);
|
||||||
const entries = result.stdout
|
const entries = result.stdout
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export async function validateVmExists(vmName) {
|
|||||||
|
|
||||||
export async function listSnapshotsForVm(vmName) {
|
export async function listSnapshotsForVm(vmName) {
|
||||||
await validateVmExists(vmName);
|
await validateVmExists(vmName);
|
||||||
const result = await runRestic(['snapshots', '--json', '--tag', vmName]);
|
const result = await runRestic(['--no-lock', 'snapshots', '--json', '--tag', vmName]);
|
||||||
const snapshots = JSON.parse(result.stdout || '[]');
|
const snapshots = JSON.parse(result.stdout || '[]');
|
||||||
return snapshots.sort((a, b) => String(b.time || '').localeCompare(String(a.time || '')));
|
return snapshots.sort((a, b) => String(b.time || '').localeCompare(String(a.time || '')));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user