summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Beaupré2011-03-11 21:46:29 (GMT)
committerAntoine Beaupré2011-03-11 21:46:29 (GMT)
commit5e8329b3c73e37b4c1c598a2c252716262afdc18 (patch)
tree7fd5fd9652b734010daa1041defe8346e264e944
parentb8230986ccb5dd2269ee7921f3ec609918cb00a5 (diff)
#1074966 by tbosviel - add aliases to the zone
we do not add aliases to new zones, however
-rw-r--r--dns/dns.drush.inc18
1 files changed, 16 insertions, 2 deletions
diff --git a/dns/dns.drush.inc b/dns/dns.drush.inc
index 6b60034..b396ac4 100644
--- a/dns/dns.drush.inc
+++ b/dns/dns.drush.inc
@@ -322,6 +322,7 @@ class provisionService_dns extends provisionService {
$host = $this->context->uri;
$zone = $this->context->dns_zone;
$sub = $this->context->dns_zone_subdomain;
+ $aliases = $this->context->aliases;
}
else {
return drush_set_error('DRUSH_DNS_NO_ZONE', "Could not determine the zone to create");
@@ -340,6 +341,12 @@ class provisionService_dns extends provisionService {
}
$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_config('host');
@@ -363,14 +370,21 @@ class provisionService_dns extends provisionService {
$host = $this->context->uri;
$zone = $this->context->dns_zone;
$sub = $this->context->dns_zone_subdomain;
+ $aliases = $this->context->aliases;
}
else {
return drush_set_error('DRUSH_DNS_NO_ZONE', "Could not determine the zone to create");
}
// remove the records from the zone store
- $this->config('zone', $zone)->
- record_set($sub, array('A' => null))->write();
+ $this->config('zone', $zone)->record_set($sub, array('A' => NULL));
+ 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();
}
}