Commit 124a2447 authored by Jon Pugh's avatar Jon Pugh

Load server_config_path from config yml, if empty, generate it dynamically...

Load server_config_path from config yml, if empty, generate it dynamically from provision config_path and server name.
parent 27084390
...@@ -29,6 +29,10 @@ class ServerContext extends ContextProvider implements ConfigurationInterface ...@@ -29,6 +29,10 @@ class ServerContext extends ContextProvider implements ConfigurationInterface
public $type = 'server'; public $type = 'server';
const TYPE = 'server'; const TYPE = 'server';
/**
* @var string
* The path to store the server's configuration files in. ie. /var/aegir/config/server_master.
*/
public $server_config_path; public $server_config_path;
/** /**
...@@ -45,8 +49,15 @@ class ServerContext extends ContextProvider implements ConfigurationInterface ...@@ -45,8 +49,15 @@ class ServerContext extends ContextProvider implements ConfigurationInterface
{ {
// @TODO: Create a 'servers_path' to keep things nice and clean. // @TODO: Create a 'servers_path' to keep things nice and clean.
parent::__construct($name, $provision, $options); parent::__construct($name, $provision, $options);
$this->server_config_path = $this->getProvision()->getConfig()->get('config_path') . DIRECTORY_SEPARATOR . $name;
$this->properties['server_config_path'] = $this->server_config_path; // If server_config_path property is empty, generate it from provision config_path + server name.
if (empty($this->getProperty('server_config_path'))) {
$this->server_config_path = $this->getProvision()->getConfig()->get('config_path') . DIRECTORY_SEPARATOR . $name;
$this->setProperty('server_config_path', $this->server_config_path);
}
else {
$this->server_config_path = $this->getProperty('server_config_path');
}
$this->fs = new Filesystem(); $this->fs = new Filesystem();
} }
...@@ -84,7 +95,13 @@ class ServerContext extends ContextProvider implements ConfigurationInterface ...@@ -84,7 +95,13 @@ class ServerContext extends ContextProvider implements ConfigurationInterface
'master_url' => 'master_url' =>
Provision::newProperty() Provision::newProperty()
->description('server: Hostmaster URL') ->description('server: Hostmaster URL')
->required(FALSE),
'server_config_path' =>
Provision::newProperty()
->description('server: The location to store the server\'s configuration files. If left empty, will be generated automatically.')
->required(FALSE) ->required(FALSE)
,
]; ];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment