admin: fix checks of go-vod bin

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
pull/563/head
Varun Patil 2023-04-10 17:57:57 -07:00
parent 98df8aa7b1
commit 4871c2c2bc
2 changed files with 16 additions and 20 deletions

View File

@ -152,6 +152,14 @@ class BinExt
]); ]);
} }
/**
* Get temp binary for go-vod.
*/
public static function getGoVodBin()
{
return self::getTempBin(Util::getSystemConfig('memories.vod.path'), 'go-vod-'.self::GOVOD_VER);
}
/** /**
* If local, restart the go-vod instance. * If local, restart the go-vod instance.
* If external, configure the go-vod instance. * If external, configure the go-vod instance.
@ -166,24 +174,11 @@ class BinExt
} }
// Get transcoder path // Get transcoder path
$transcoder = self::getTempBin(Util::getSystemConfig('memories.vod.path'), 'go-vod-'.self::GOVOD_VER); $transcoder = self::getGoVodBin();
if (empty($transcoder)) { if (empty($transcoder)) {
throw new \Exception('Transcoder not configured'); throw new \Exception('Transcoder not configured');
} }
// Make sure transcoder exists
if (!file_exists($transcoder)) {
throw new \Exception("Transcoder not found; ({$transcoder})");
}
// Make transcoder executable
if (!is_executable($transcoder)) {
@chmod($transcoder, 0755);
if (!is_executable($transcoder)) {
throw new \Exception("Transcoder not executable (chmod 755 {$transcoder})");
}
}
// Get local config // Get local config
$env = self::getGoVodConfig(true); $env = self::getGoVodConfig(true);
$tmpPath = $env['tempdir']; $tmpPath = $env['tempdir'];

View File

@ -133,15 +133,16 @@ class OtherController extends GenericApiController
$status['ffprobe'] = $this->getExecutableStatus(Util::getSystemConfig('memories.vod.ffprobe')); $status['ffprobe'] = $this->getExecutableStatus(Util::getSystemConfig('memories.vod.ffprobe'));
// Check go-vod binary // Check go-vod binary
$status['govod'] = $this->getExecutableStatus(Util::getSystemConfig('memories.vod.path'));
if ('ok' === $status['govod'] || Util::getSystemConfig('memories.vod.external')) {
try { try {
$s = $this->getExecutableStatus(BinExt::getGoVodBin());
if ('ok' === $s || Util::getSystemConfig('memories.vod.external')) {
BinExt::testStartGoVod(); BinExt::testStartGoVod();
$status['govod'] = 'test_ok'; $s = 'test_ok';
}
$status['govod'] = $s;
} catch (\Exception $e) { } catch (\Exception $e) {
$status['govod'] = 'test_fail:'.$e->getMessage(); $status['govod'] = 'test_fail:'.$e->getMessage();
} }
}
// Check for VA-API device // Check for VA-API device
$devPath = '/dev/dri/renderD128'; $devPath = '/dev/dri/renderD128';