コード例 #1
0
ファイル: common.php プロジェクト: samkeen/kiln-php
/**
 * Default path for config is './config/config.yml'
 * If the cli arg --config is given, that path is used.  It supports s3 bucket paths
 *
 *   ex: `php run.php --config s3:///kiln-config/testing/config.yml`
 *
 * @param string $configPath
 * @param \Psr\Log\LoggerInterface $logger
 * @return \Io\Samk\AmiBuilder\Utils\Config
 */
function getConfig($configPath, \Psr\Log\LoggerInterface $logger)
{
    try {
        return new \Io\Samk\AmiBuilder\Utils\Config($configPath);
    } catch (\Exception $e) {
        $logger->error("There was a problem loading the config. Error: '{$e->getMessage()}'");
        shutDown("Problem Loading Config File.  Error: '{$e->getMessage()}'");
    }
}
コード例 #2
0
ファイル: init-config.php プロジェクト: samkeen/kiln-php
/**
 * @param string $argName
 * @param array $cliArgs
 * @param array $cliDefinitions
 * @return string
 */
function getCliArg($argName, $cliArgs, $cliDefinitions)
{
    $argValue = getCliArgValue($cliArgs, "--{$argName}");
    if ($cliDefinitions[$argName]['required'] && empty($argValue)) {
        echo getUsage($cliDefinitions);
        shutDown($cliDefinitions[$argName]['errorMessage']);
    }
    return $argValue;
}
コード例 #3
0
ファイル: test.php プロジェクト: samkeen/kiln-php
/**
 * @param $cliOutput
 * @param $returnCode
 */
function checkCliResponse($cliOutput, $returnCode)
{
    if ($returnCode == 0) {
        echo "Success\n";
    } else {
        echo "Received non-zero return code '{$returnCode}', Output was:\n";
        echo implode("\n", $cliOutput);
        shutDown();
    }
}
コード例 #4
0
ファイル: run.php プロジェクト: samkeen/kiln-php
/**
 * @param \Aws\S3\S3Client $s3Client
 * @param string $keyName
 * @param array $digestConfig
 * @param string $digestContent
 * @param \Psr\Log\LoggerInterface $logger
 * @return mixed
 * @internal param \Aws\Common\Aws $aws
 */
function writeExecutionDigest(\Aws\S3\S3Client $s3Client, $keyName, $digestConfig, $digestContent, $logger)
{
    $bucketName = $digestConfig["bucketName"];
    try {
        $result = $s3Client->putObject(array('Bucket' => $bucketName, 'Key' => $keyName, 'Body' => $digestContent));
    } catch (\Aws\S3\Exception\S3Exception $e) {
        $logger->error("ERROR PUTing to bucket '{$bucketName}': {$e->getMessage()}" . "\n");
        shutDown("S3Exception PUTing to bucket '{$bucketName}': {$e->getMessage()}" . "\n");
    } catch (Exception $e) {
        $logger->error("Exception PUTing to bucket '{$bucketName}': {$e->getMessage()}" . "\n");
        shutDown("ERROR PUTing to bucket '{$bucketName}': {$e->getMessage()}" . "\n");
    }
    return $result;
}