Diagnostic tool: add the result of prosodyctl check in the debug section.

This commit is contained in:
John Livingston 2023-04-07 14:34:10 +02:00 committed by John Livingston
parent aa5ff3cfb2
commit c81c2eb9bb
3 changed files with 19 additions and 1 deletions

View File

@ -1,5 +1,11 @@
# Changelog # Changelog
## ??? (Not Released Yet)
### Minor changes and fixes
* Diagnostic tool: add the result of `prosodyctl check` in the debug section.
## 6.2.3 ## 6.2.3
### Minor changes and fixes ### Minor changes and fixes

View File

@ -1,6 +1,6 @@
import type { RegisterServerOptions } from '@peertube/peertube-types' import type { RegisterServerOptions } from '@peertube/peertube-types'
import { getProsodyConfig, getProsodyConfigContentForDiagnostic, getWorkingDir } from '../prosody/config' import { getProsodyConfig, getProsodyConfigContentForDiagnostic, getWorkingDir } from '../prosody/config'
import { getProsodyAbout, testProsodyCorrectlyRunning } from '../prosody/ctl' import { checkProsody, getProsodyAbout, testProsodyCorrectlyRunning } from '../prosody/ctl'
import { newResult, TestResult } from './utils' import { newResult, TestResult } from './utils'
import { getAPIKey } from '../apikey' import { getAPIKey } from '../apikey'
import * as fs from 'fs' import * as fs from 'fs'
@ -190,6 +190,12 @@ export async function diagProsody (test: string, options: RegisterServerOptions)
return result return result
} }
const check = await checkProsody(options)
result.debug.push({
title: 'Prosody check',
message: check
})
// Checking if there is a Prosody error log, and returning last lines. // Checking if there is a Prosody error log, and returning last lines.
try { try {
await fs.promises.access(prosodyErrorLogPath, fs.constants.R_OK) // throw an error if file does not exist. await fs.promises.access(prosodyErrorLogPath, fs.constants.R_OK) // throw an error if file does not exist.

View File

@ -158,6 +158,11 @@ async function reloadProsody (options: RegisterServerOptions): Promise<boolean>
return true return true
} }
async function checkProsody (options: RegisterServerOptions): Promise<string> {
const ctl = await prosodyCtl(options, 'check')
return ctl.message
}
interface ProsodyRunning { interface ProsodyRunning {
ok: boolean ok: boolean
messages: string[] messages: string[]
@ -341,6 +346,7 @@ async function ensureProsodyNotRunning (options: RegisterServerOptions): Promise
export { export {
getProsodyAbout, getProsodyAbout,
checkProsody,
testProsodyRunning, testProsodyRunning,
testProsodyCorrectlyRunning, testProsodyCorrectlyRunning,
prepareProsody, prepareProsody,