• Модуль: scale
  • Путь к файлу: ~/bitrix/modules/scale/lib/serversdata.php
  • Класс: BitrixScaleServersData
  • Вызов: ServersData::getBxInfo
static function getBxInfo($hostname)
{
	if($hostname == '')
		throw new BitrixMainArgumentNullException("hostname");

	$result = array();

	if(isset(static::$bxInfo[$hostname]))
	{
		$result = static::$bxInfo[$hostname];
	}
	else
	{
		$action =  new Action("get_bx_info", array(
				"START_COMMAND_TEMPLATE" => "sudo -u root /opt/webdir/bin/wrapper_ansible_conf -a bx_info -H ".$hostname." -o json",
				"LOG_LEVEL" => Logger::LOG_LEVEL_DISABLE
			),
			"",
			array()
		);

		$action->start();
		$actRes = $action->getResult();

		if(isset($actRes["get_bx_info"]["OUTPUT"]["DATA"]["params"]["bx_variables"][$hostname]))
		{
			$result = static::$bxInfo[$hostname] = $actRes["get_bx_info"]["OUTPUT"]["DATA"]["params"]["bx_variables"][$hostname];
		}
		elseif(isset($actRes["get_bx_info"]["RESULT"])
			&& $actRes["get_bx_info"]["RESULT"] = "ERROR"
				&& $actRes["get_bx_info"]["ERROR"] <> ''
		)
		{
			throw new BitrixScaleServerBxInfoException($actRes["get_bx_info"]["ERROR"], $hostname);
		}
	}

	return $result;
}