refactor(mikrotikBackupRoutes, mikrotikBackupScheduler): update backup export command to use /rest/execute with compact terse script for improved reliability
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 2m19s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 2m19s
This commit is contained in:
@@ -261,8 +261,8 @@ async function runBackupNow(req, res) {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /rest/export с compact, как в планировщике
|
// /rest/execute с командой "/export compact terse", как в планировщике
|
||||||
const resp = await client.command('export', { compact: '' });
|
const resp = await client.command('execute', { script: '/export compact terse' });
|
||||||
const data = resp && resp.data;
|
const data = resp && resp.data;
|
||||||
let config = '';
|
let config = '';
|
||||||
if (typeof data === 'string') config = data;
|
if (typeof data === 'string') config = data;
|
||||||
|
|||||||
@@ -53,9 +53,8 @@ async function getServerIdsFromUiSettings(logger) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function fetchRouterExport(client) {
|
async function fetchRouterExport(client) {
|
||||||
// Согласно официальной документации, /rest/export позволяет экспортировать конфиг.
|
// Используем /rest/execute с командой "/export compact terse", чтобы гарантированно получить вывод в ответе.
|
||||||
// Параметр "compact" без значения эквивалентен /export compact.
|
const res = await client.command('execute', { script: '/export compact terse' });
|
||||||
const res = await client.command('export', { compact: '' });
|
|
||||||
const data = res && res.data;
|
const data = res && res.data;
|
||||||
if (!data) return '';
|
if (!data) return '';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user