I don't know is a new problem or not. I couldn't find in issues.

The problem is:
With the last code of 6-1.x-dev I try access to node/add/site but I get this error:
PHP Fatal error: Call to a member function has_port() on a non-object in /var/aegir/hostmaster-6.x-1.9/profiles/hostmaster/modules/hosting/site/hosting_site.module on line 160

The code of the problem is this:

function _hosting_site_url($node) {
  $schema = 'http';
  $port = null;

  $url = strtolower(trim($node->title));

  $platform = node_load($node->platform);
  $server = node_load($platform->web_server);


  if ($server->services['http']->has_port()) {
    $port = $server->services['http']->port;
    if ($port == 80) {
      $port = null;
    }
  }

If is a new node $node->platform is empty and then $server is null instead object. I think that is need add the next condition:
if ($server && $server->services['http']->has_port()) {

Comments

anarcat’s picture

Status: Active » Postponed (maintainer needs more info)

We could add such a check, it would be a good idea. But then what do we do with it? it wouldn't resolve your issue, which is that your database seems to be inconsistent... Normally, each site node has a platform associated to it, and everything falls into place from there. Why would this function be called before the site is properly formed is beyond me. I see only two instances of this being called in core:

http://api.aegirproject.org/api/Hostmaster/modules--hosting--site--hosti...

Both of which should apply only after the node was created. How did you manage to generate this error?

fastangel’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Yes I had problem with database inconsistent.

anarcat’s picture

Category: bug » support