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;
|
||||
}
|
||||
|
||||
// /rest/export с compact, как в планировщике
|
||||
const resp = await client.command('export', { compact: '' });
|
||||
// /rest/execute с командой "/export compact terse", как в планировщике
|
||||
const resp = await client.command('execute', { script: '/export compact terse' });
|
||||
const data = resp && resp.data;
|
||||
let config = '';
|
||||
if (typeof data === 'string') config = data;
|
||||
|
||||
@@ -53,9 +53,8 @@ async function getServerIdsFromUiSettings(logger) {
|
||||
}
|
||||
|
||||
async function fetchRouterExport(client) {
|
||||
// Согласно официальной документации, /rest/export позволяет экспортировать конфиг.
|
||||
// Параметр "compact" без значения эквивалентен /export compact.
|
||||
const res = await client.command('export', { compact: '' });
|
||||
// Используем /rest/execute с командой "/export compact terse", чтобы гарантированно получить вывод в ответе.
|
||||
const res = await client.command('execute', { script: '/export compact terse' });
|
||||
const data = res && res.data;
|
||||
if (!data) return '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user