Storage: cosmetics

This commit is contained in:
Thomas Gelf 2017-01-11 15:56:51 +01:00
parent f769fd3855
commit fc117217dd
3 changed files with 20 additions and 2 deletions

View file

@ -5,8 +5,8 @@ namespace Icinga\Module\Businessprocess\Storage;
use Icinga\Application\Benchmark;
use Icinga\Exception\ConfigurationError;
use Icinga\Exception\SystemPermissionException;
use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\Metadata;
class LegacyConfigParser
@ -42,6 +42,12 @@ class LegacyConfigParser
return $this->config;
}
/**
* @param $name
* @param $filename
*
* @return BpConfig
*/
public static function parseFile($name, $filename)
{
Benchmark::measure('Loading business process ' . $name);
@ -51,6 +57,12 @@ class LegacyConfigParser
return $parser->getParsedConfig();
}
/**
* @param $name
* @param $string
*
* @return BpConfig
*/
public static function parseString($name, $string)
{
Benchmark::measure('Loading BP config from file: ' . $name);

View file

@ -51,7 +51,7 @@ class LegacyConfigRenderer
continue;
}
$str .= sprintf("# %-11s : %s\n", $key, $value);
$str .= sprintf("# %-15s : %s\n", $key, $value);
}
$str .= "#\n###################################\n\n";

View file

@ -162,6 +162,12 @@ class LegacyStorage extends Storage
return $this->getConfigDir() . '/' . $name . '.conf';
}
/**
* @param $name
* @param $string
*
* @return BpConfig
*/
public function loadFromString($name, $string)
{
return LegacyConfigParser::parseString($name, $string);