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 external, configure the go-vod instance.
@ -166,24 +174,11 @@ class BinExt
}
// Get transcoder path
$transcoder = self::getTempBin(Util::getSystemConfig('memories.vod.path'), 'go-vod-'.self::GOVOD_VER);
$transcoder = self::getGoVodBin();
if (empty($transcoder)) {
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
$env = self::getGoVodConfig(true);
$tmpPath = $env['tempdir'];

View File

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