Commit 703beac0 authored by Adrian Rossouw's avatar Adrian Rossouw

Introduce a setContext method, that the cluster class can use to set the context of it's children.

parent fb78e23b
......@@ -11,6 +11,13 @@ class provisionService_http_cluster extends provisionService_http {
$this->server->setProperty('cluster_web_servers', array(), TRUE);
}
function setContext($name) {
parent::setContext($name);
foreach ($this->server->cluster_web_servers as $server) {
call_user_func_array(array(d($server)->service('http'), 'setContext'), array($name));
}
}
function _each_server($method, $args = array()) {
foreach ($this->server->cluster_web_servers as $server) {
call_user_func_array(array(d($server)->service('http'), $method), $args);
......
......@@ -331,7 +331,7 @@ class provisionServer extends provisionEnvironment {
* Retrieve a service of a specific type from the environment.
*/
function service($service, $name = null) {
$this->services[$service]->context = ($name) ? $name : $this->name;
$this->services[$service]->setContext(($name) ? $name : $this->name);
return $this->services[$service];
}
......
......@@ -13,6 +13,10 @@ class provisionService extends provisionChainedState {
$this->server = d($server);
}
function setContext($name) {
$this->context = $name;
}
function sync($path = NULL, $exclude_sites = FALSE) {
return $this->server->sync($path, $exclude_sites);
}
......
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