protected getDsbuildFilename ( string $baseFolder, DataSift\Stone\ObjectLib\BaseObject $provConfig, string $hostId ) : string | null | ||
$baseFolder | string | the folder we should look in |
$provConfig | DataSift\Stone\ObjectLib\BaseObject | the "provisioning" section from the test environment config |
$hostId | string | the ID of the host that we are provisioning |
return | string | null | path to the file to execute |
protected function getDsbuildFilename($baseFolder, $provConfig, $hostId)
{
if (isset($provConfig->execute)) {
$basename = dirname($provConfig->execute) . "/" . basename($provConfig->execute, '.sh');
} else {
$basename = "dsbuildfile";
}
$candidateFilenames = [$basename . "-" . $hostId . '.sh', $basename . "-" . $hostId, $basename . ".sh", $basename];
foreach ($candidateFilenames as $candidateFilename) {
if (file_exists($baseFolder . '/' . $candidateFilename)) {
return $candidateFilename;
}
}
// no file found
return null;
}