Commit 459f0f14 authored by anarcat's avatar anarcat Committed by Adrian Rossouw

reorder type/destination to be more logical

parent eaeb1de9
......@@ -2,7 +2,7 @@ To test this:
drush provision-save @server_localhost --dns_service_type=bind
drush @server_localhost provision-zone create foobar.com
drush @server_localhost provision-zone rr-add foobar.com www 1.2.3.4 A
drush @server_localhost provision-zone rr-add foobar.com www A 1.2.3.4
You should end up with a zonefile like:
......
......@@ -89,7 +89,7 @@ class provisionService_dns_bind extends provisionService_dns {
}
}
function add_record($zonename, $name, $destination, $type = 'A') {
function add_record($zonename, $name, $type, $destination) {
$zone = new provisionConfig_bind_zone($this->context, array('name' => $zonename));
if ($type == 'SOA') { // only one SOA per file
return $zone->add_line_if_not_exists($name . ' IN SOA ' . $destination, '/(?:@\s+)?IN\s+SOA\s+/');
......@@ -98,7 +98,7 @@ class provisionService_dns_bind extends provisionService_dns {
}
}
function edit_record($zonename, $name, $destination, $type = 'A') {
function edit_record($zonename, $name, $type, $destination) {
$zone = new provisionConfig_bind_zone($this->context, array('name' => $zonename));
$pattern = "/^\s*$name\s+IN\s+$type\s+.*$/im";
if ($type == 'SOA') {
......@@ -107,7 +107,7 @@ class provisionService_dns_bind extends provisionService_dns {
return $zone->replace_or_add_line($name . "\tIN\t" . $type . "\t" . $destination, $pattern);
}
function delete_record($zonename, $name, $destination = null, $type = null) {
function delete_record($zonename, $name, $type = null, $destination = null) {
$zone = new provisionConfig_bind_zone($this->context, array('name' => $zonename));
$pattern = "/^$name\s\s*IN\s\s*";
if (is_null($type)) {
......
......@@ -23,7 +23,7 @@ function dns_drush_command() {
return $items;
}
function drush_dns_provision_zone($action, $zone, $name = null, $destination = null, $type = null) {
function drush_dns_provision_zone($action, $zone, $name = null, $type = null, $destination = null) {
switch ($action) {
case 'verify':
case 'create':
......@@ -33,13 +33,13 @@ function drush_dns_provision_zone($action, $zone, $name = null, $destination = n
$status = d()->service('dns')->delete_zone($zone);
break;
case 'rr-add':
$status = d()->service('dns')->add_record($zone, $name, $destination, $type);
$status = d()->service('dns')->add_record($zone, $name, $type, $destination);
break;
case 'rr-modify':
$status = d()->service('dns')->modify_record($zone, $name, $destination, $type);
$status = d()->service('dns')->modify_record($zone, $name, $type, $destination);
break;
case 'rr-delete':
$status = d()->service('dns')->delete_record($zone, $name, $destination, $type);
$status = d()->service('dns')->delete_record($zone, $name, $type, $destination);
break;
}
$status = $status && d()->service('dns')->commit($zone);
......@@ -181,14 +181,14 @@ class provisionService_dns extends provisionService {
* This doesn't check if the record already exists, it just adds it
* to the end of the file.
*/
function add_record($zonename, $name, $destination, $type = 'A') {
function add_record($zonename, $name, $type, $destination) {
return FALSE;
}
/**
* This creates or replaces a record (RR) in a zonefile.
*/
function edit_record($zonename, $name, $destination, $type = 'A') {
function edit_record($zonename, $name, $type, $destination) {
return FALSE;
}
......@@ -197,7 +197,7 @@ class provisionService_dns extends provisionService {
*
* If destination or type is null, they are disregarded in the pattern.
*/
function delete_record($zonename, $name, $destination = null, $type = null) {
function delete_record($zonename, $name, $type, $destination = null) {
return FALSE;
}
......
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