Commit 23e1e129 authored by anarcat's avatar anarcat Committed by omega8cc

properly get rid of site_ip_addresses, replaced by ip_address

parent de208155
<?php
foreach ($site_ip_addresses as $server => $ip) {
foreach ($ip_addresses as $server => $ip) {
print "{$ip}\t {$this->uri}\n";
}
?>
......@@ -136,7 +136,13 @@ class Provision_Service_dns extends Provision_Service {
}
if ($config == 'host') {
$data['site_ip_addresses'] = drush_get_option('site_ip_addresses', array(), 'site');
// get the IP explicitely allocate to this site
$ips = drush_get_option('ip_address', array(), 'site');
// .. or the server IPs if none is allocated
if (count($ips) < 1) {
$ips = $this->server->ip_addresses;
}
$data['ip_address'] = $ips;
}
return $data;
......@@ -244,7 +250,7 @@ class Provision_Service_dns extends Provision_Service {
return $status;
}
/**
/**
* Create a host in DNS.
*
* This can do a lot of things, create a zonefile, add a record to a
......@@ -270,18 +276,13 @@ class Provision_Service_dns extends Provision_Service {
return drush_set_error('DRUSH_DNS_NO_ZONE', "Could not determine the zone to create");
}
$ips = drush_get_option('site_ip_addresses', array(), 'site');
$ips = drush_get_option('ip_address', array(), 'site');
if (!$ips && count($ips) < 1) {
drush_log(dt("no IP found for server, trying loopback"));
$ips = array('127.0.0.1');
}
// XXX: kill me?
if (!is_array($ips)) {
$ips = array($ips); // backward compatibility?
}
$this->config('zone', $zone)->record_set($sub, array('A' => $ips));
foreach ($aliases as $alias) {
if ($this->guess_zone($alias) == $zone) {
......
......@@ -14,32 +14,6 @@ class Provision_Config_Http_Site extends Provision_Config_Http {
return $this->data['http_vhostd_path'] . '/' . $this->uri;
}
function write() {
parent::write();
// We also leave a record of this IP in the site's drushrc.php
// This way we can pass the info back to the front end.
$ip_addresses = drush_get_option('site_ip_addresses', array(), 'site');
if ($this->data['ip_address'] != '*') {
$ip_addresses[$this->data['server']->name] = $this->data['ip_address'];
}
elseif (isset($context['site_ip_addresses'][$this->data['server']->name])) {
unset($ip_addresses[$this->data['server']->name]);
}
drush_set_option('site_ip_addresses', $ip_addresses, 'site');
}
function unlink() {
parent::unlink();
// We also remove the record of this IP in the site's drushrc.php
// This way we can pass the info back to the front end.
$ip_addresses = drush_get_option('site_ip_addresses', array(), 'site');
unset($ip_addresses[$this->data['server']->name]);
drush_set_option('site_ip_addresses', $ip_addresses, 'site');
}
function process() {
parent::process();
......
......@@ -15,7 +15,6 @@ class Provision_Config_Http_Ssl_Site extends Provision_Config_Http_Site {
function write() {
parent::write();
$ip_addresses = drush_get_option('site_ip_addresses', array(), 'site');
if ($this->ssl_enabled && $this->ssl_key) {
$path = dirname($this->data['ssl_cert']);
// Make sure the ssl.d directory in the server ssl.d exists.
......@@ -28,7 +27,7 @@ class Provision_Config_Http_Ssl_Site extends Provision_Config_Http_Site {
// Touch a file in the server's copy of this key, so that it knows the key is in use.
// XXX: test. data structure may not be sound. try d($this->uri)
// if $this fails
Provision_Service_http_ssl::assign_certificate_site($ssl_key, $this);
Provision_Service_http_ssl::assign_certificate_site($this->ssl_key, $this);
// Copy the certificates to the server's ssl.d directory.
provision_file()->copy(
......
......@@ -145,7 +145,8 @@ class Provision_Service_http_ssl extends Provision_Service_http_public {
* @return the path to the receipt file if allocation succeeded
*/
static function assign_certificate_site($ssl_key, $site) {
$path = $site->platform->server->httpd_ssld_path . "/" . $ssl_key . "/" . $site->uri . ".receipt";
$path = $site->platform->server->http_ssld_path . "/" . $ssl_key . "/" . $site->uri . ".receipt";
drush_log(dt("registering site %site with SSL certificate %key with receipt file %path", array("%site" => $site->uri, "%key" => $ssl_key, "%path" => $path)));
if (touch($path)) {
return $path;
}
......
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