Commit 5e8329b3 authored by anarcat's avatar anarcat

#1074966 by tbosviel - add aliases to the zone

we do not add aliases to new zones, however
parent b8230986
...@@ -322,6 +322,7 @@ class provisionService_dns extends provisionService { ...@@ -322,6 +322,7 @@ class provisionService_dns extends provisionService {
$host = $this->context->uri; $host = $this->context->uri;
$zone = $this->context->dns_zone; $zone = $this->context->dns_zone;
$sub = $this->context->dns_zone_subdomain; $sub = $this->context->dns_zone_subdomain;
$aliases = $this->context->aliases;
} }
else { else {
return drush_set_error('DRUSH_DNS_NO_ZONE', "Could not determine the zone to create"); return drush_set_error('DRUSH_DNS_NO_ZONE', "Could not determine the zone to create");
...@@ -340,6 +341,12 @@ class provisionService_dns extends provisionService { ...@@ -340,6 +341,12 @@ class provisionService_dns extends provisionService {
} }
$this->config('zone', $zone)->record_set($sub, array('A' => $ips)); $this->config('zone', $zone)->record_set($sub, array('A' => $ips));
foreach ($aliases as $alias) {
if ($this->guess_zone($alias) == $zone) {
$this->config('zone', $zone)->record_set($this->guess_zone($alias, 'subdomain'),
array('CNAME' => array($zone . '.')));
}
}
$this->create_zone($zone); $this->create_zone($zone);
$this->create_config('host'); $this->create_config('host');
...@@ -363,14 +370,21 @@ class provisionService_dns extends provisionService { ...@@ -363,14 +370,21 @@ class provisionService_dns extends provisionService {
$host = $this->context->uri; $host = $this->context->uri;
$zone = $this->context->dns_zone; $zone = $this->context->dns_zone;
$sub = $this->context->dns_zone_subdomain; $sub = $this->context->dns_zone_subdomain;
$aliases = $this->context->aliases;
} }
else { else {
return drush_set_error('DRUSH_DNS_NO_ZONE', "Could not determine the zone to create"); return drush_set_error('DRUSH_DNS_NO_ZONE', "Could not determine the zone to create");
} }
// remove the records from the zone store // remove the records from the zone store
$this->config('zone', $zone)-> $this->config('zone', $zone)->record_set($sub, array('A' => NULL));
record_set($sub, array('A' => null))->write(); foreach ($aliases as $alias) {
if ($this->guess_zone($alias) == $zone) {
$this->config('zone', $zone)->record_set($this->guess_zone($alias, 'subdomain'),
array('CNAME' => NULL));
}
}
$this->config('zone', $zone)->write();
} }
} }
......
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