Commit 7797b8d9 authored by Adrian Rossouw's avatar Adrian Rossouw

Make slave dns actually work. The master zone data store was being wiped out by the slave server.

They use the same data store. Additionally commented out the create_host logic in bind_slave, which
is not necessary.

The code also would not work for anything other than the server context. Which means site dns entries
were being not only lost, but wiped out.
parent 636e2c4a
......@@ -48,7 +48,6 @@ class provisionService_dns_bind_slave extends provisionService_dns {
* @arg $zone string the zonefile name to create
*
* @see provisionService_dns::create_zone()
*/
function create_zone($master, $zone = null) {
if (is_null($zone) && ($this->context->type == 'site')) {
$host = $this->context->uri;
......@@ -62,9 +61,20 @@ class provisionService_dns_bind_slave extends provisionService_dns {
drush_log(dt("recording zone in slave configuration"));
$this->config('server')->record_set($zone, $master)->write();
}
*/
}
class provisionConfig_bind_slave extends provisionConfig_dns_server {
public $template = 'slave.tpl.php';
function process() {
parent::process();
if ($this->context->type == 'server') {
$ips = $this->context->ip_addresses;
}
else {
$ips = $this->context->server->ip_addresses;
}
$this->data['master_ip_list'] = implode(';', $ips);
}
}
<?php
foreach ($records as $zone => $master) {
if (is_array($master)) {
$master = implode(";", $master);
}
printf('zone "%s" { type slave; file "%s/%s.zone"; masters { %s; }; allow-query { any; }; };' . "\n", $zone, $dns_zoned_path, $zone, $master);
printf('zone "%s" { type slave; file "%s/%s.zone"; masters { %s; }; allow-query { any; }; };' . "\n", $zone, $dns_zoned_path, $zone, $master_ip_list);
}
?>
......@@ -281,7 +281,7 @@ class provisionService_dns extends provisionService {
if ($status) {
drush_log(dt("creating zone configuration on slaves"));
$status = $this->_each_server("create_zone", array($this->context->ip_addresses, $zone));
$status = $this->_each_server("create_zone", $zone);
}
return $status;
}
......
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