Commit 68c205c0 authored by anarcat's avatar anarcat Committed by anarcat

no need to specify the url, we have it in the context

parent d08d070b
...@@ -233,9 +233,16 @@ class provisionService_dns extends provisionService { ...@@ -233,9 +233,16 @@ class provisionService_dns extends provisionService {
* Create a host in DNS. * Create a host in DNS.
* *
* This can do a lot of things, create a zonefile, add a record to a * This can do a lot of things, create a zonefile, add a record to a
* zonefile, it's going to make its best guess doing the Right Thing. * zonefile, it's going to make its best guess doing the Right
* Thing.
*
* @arg $host string the hostname to create. If null, we look in the
* current context (should be a site) for a URI.
*/ */
function create_host($host) { function create_host($host = null) {
if (is_null($host)) {
$host = $this->context->uri;
}
$parts = $this->guess_zone($host); $parts = $this->guess_zone($host);
$zone = $parts[1]; $zone = $parts[1];
$sub = $parts[0]; $sub = $parts[0];
...@@ -263,8 +270,14 @@ class provisionService_dns extends provisionService { ...@@ -263,8 +270,14 @@ class provisionService_dns extends provisionService {
* Delete a host from DNS * Delete a host from DNS
* *
* Similar to create host, this will seek and destroy that host throughout zonefiles. * Similar to create host, this will seek and destroy that host throughout zonefiles.
*
* @arg $host string the hostname to create. If null, we look in the
* current context (should be a site) for a URI.
*/ */
function delete_host($host) { function delete_host($host = null) {
if (is_null($host)) {
$host = $this->context->uri;
}
$parts = $this->guess_zone($host); $parts = $this->guess_zone($host);
$this->delete_record($parts[0], $parts[1], 'A'); $this->delete_record($parts[0], $parts[1], 'A');
if ($this->count_records($parts[0], null, array('NS', 'SOA'))) { if ($this->count_records($parts[0], null, array('NS', 'SOA'))) {
......
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
function drush_dns_pre_provision_install() { function drush_dns_pre_provision_install() {
if (d()->type == 'site') { if (d()->type == 'site') {
d()->service('dns')->create_host(d()->uri); d()->service('dns')->create_host();
} }
} }
function drush_dns_pre_provision_install_rollback() { function drush_dns_pre_provision_install_rollback() {
if (d()->type == 'site') { if (d()->type == 'site') {
d()->service('dns')->delete_host(d()->uri); d()->service('dns')->delete_host();
} }
} }
......
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