You are here

function hosting_server_drush_context_import in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 server/hosting_server.drush.inc \hosting_server_drush_context_import()
  2. 7.4 server/hosting_server.drush.inc \hosting_server_drush_context_import()

Implements hook_drush_context_import().

File

server/hosting_server.drush.inc, line 43
:Drush hooks for the Hosting server module.

Code

function hosting_server_drush_context_import($context, &$node) {
  if ($context->type == 'server') {
    if (!isset($node->title)) {
      $node->title = strtolower($context->remote_host);
    }
    $node->new_ip_addresses = implode("\n", $context->ip_addresses);
    foreach (hosting_server_services() as $type => $info) {
      if (isset($context->{$type . '_service_type'})) {
        $service_type = $context->{$type . '_service_type'};
        if (isset($node->services[$type])) {
          if ($node->services[$type]->type != $service_type) {
            unset($node->services[$type]);
          }
        }
        if (!isset($node->services[$type])) {

          // Only support the base configuration things for now.
          hosting_services_add($node, $type, $service_type, $values);
        }
        $node->services[$type]
          ->context_import($context);
      }
    }
  }
}