Commit a1ef6812 authored by anarcat's avatar anarcat Committed by Adrian Rossouw

port verify and delete to the new API, remove restore

parent 459f0f14
......@@ -15,7 +15,13 @@
* (ie: pull off the tld and second-level domain for the 'base' zone, and treat the rest as the 'name')
*/
function drush_dns_provision_delete($url = NULL) {
if ($url) {
# dns_delete($url);
if (d()->type == 'site') {
d()->service('dns')->delete_host(d()->uri);
}
}
function drush_dns_post_provision_delete() {
if (d()->type == 'site') {
d()->service('dns')->commit();
}
}
<?php
// $Id: restore.provision.inc,v 1.4 2009/05/07 22:04:30 adrian Exp $
/**
* @file
* Provision hooks for the restore command
**/
/**
* Implementation of hook_provision_pre_restore
* This is a duplicate of the _pre_install hook
**/
function drush_dns_pre_provision_restore($url = NULL) {
# re-install the zonefiles and/or resource records for the site?
# _dns_provision_pre_restore($url, $data);
}
/**
* Implementation of hook_provision_pre_restore_rollback
* This duplicates the _pre_install_rollback hook
**/
function drush_dns_pre_provision_restore_rollback($url = NULL) {
# remove them again?
if ($url) {
# _dns_delete($url);
}
}
function drush_dns_post_provision_restore($url = NULL) {
# restart bind?
}
function drush_dns_post_provision_restore_rollback($url = NULL) {
# restart bind
}
......@@ -7,8 +7,6 @@
* Provision hooks for the verify command
**/
include_once("dns.api.inc");
/**
* Implementation of hook_provision_verify
*
......@@ -18,7 +16,7 @@ function drush_dns_provision_verify() {
switch (d()->type) {
case 'server':
// we are verifying a server
# Where does this constant come from now?
// XXX: is this still necessary now that we have verify stuff in the service config?
// _provision_create_dir(PROVISION_NAMED_PATH, dt('Provision DNS configuration'), 0755);
// # The above perms should really be 750, but that means the aegir user must be in the 'bind' group, so this will work:
// provision_path("chgrp", PROVISION_NAMED_PATH, 'bind',
......@@ -26,17 +24,13 @@ function drush_dns_provision_verify() {
// dt('Could not change group ownership of '.PROVISION_NAMED_PATH.' to @confirm'));
break;
case 'site':
drush_log("notice", "Hit dns_provision_verify hook: $url");
$url_parts = _dns_split_url($url);
if (!isset($url_parts['zone'])) {
drush_set_error('PROVISION_FRAMEWORK_ERROR');
return;
}
$zone = dns_create_zone($url_parts['zone']); # initializes the zone for the domain (if it doesn't exist)
dns_create_record($url_parts['host'], $zone); # creates the RR for the (sub)domain
dns_commit(drush_get_option('dns_id')); # makes the changes live (ie: restart bind)
drush_log(dt("Edited zone file %zone", array("%zone" => $zone)));
d()->service('dns')->create_host(d()->uri);
break;
}
}
function drush_dns_post_provision_verify() {
if (d()->type == 'site') {
d()->service('dns')->commit();
}
}
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