Hi,

When trying to verify a remote hostmaster, the Aegir Hosting Remote Import module now tries to get a "Successful" result from drush @hostmaster status (or even just any bootstrap info):

  function verify_server_cmd() {
    parent::verify_server_cmd();
    // We should try to connect to the remote hostmaster server.
    $result = $this->remote_execute('@hostmaster status');
    if (
      (!isset($result['object']['Drupal bootstrap']) || ($result['object']['Drupal bootstrap'] != 'Successful')) &&
      (!isset($result['object']['bootstrap']) || ($result['object']['bootstrap'] != 'Successful'))
    ) {
      return drush_set_error('REMOTE_SERVER_IS_NOT_MASTER', dt('The specified server is not an Aegir master server.'));
    }
  }

We got an error on this since our remote drush @hostmaster status commands returned a translated version of "Successful". Furthermore the command doesn't tell us if we have really a hostmaster installation (as a default Drupal site will return a "Successful" as well). So we need better validation for this. Patch is following.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ToRum created an issue. See original summary.

ToRum’s picture

This patch should allow a translation independent check.

helmo’s picture

Thanks for the patch... multilingual fun :)

Not sure if someone ever tried but this would block us from importing from a devshop server (devmaster is their derivative install profile)

helmo’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
999 bytes

Here's an updated patch that would also work with devmaster.

Jon Pugh’s picture

Status: Reviewed & tested by the community » Needs work

Hard coding the name of the profile doesn't seem like a good idea... There's a function that checks if a site exists by testing bootstrap levels, let me look it up...

Jon Pugh’s picture

Here's the issue I worked on to improve check for active site...

https://www.drupal.org/node/2764245

For another method, I check the exit code of a drush status call in the docker containers, however that's done in bash.

https://github.com/aegir-project/dockerfiles/blob/master/docker-entrypoi...

Not sure the best way forward, but checking for install profile name isn't it. There must be some other data in that array to check?

helmo’s picture

The issue with both suggestions is that it only checks to see if the other end is an active Drupal site. The current situation also checks just that ... but depends on the install language. So testing on one of those is an improvement.

But what I think is intended by the check is to see if the other side is an OK Aegir frontend site. That array could be made configurable ... or we could test on the hosting module being enabled???

Jon Pugh’s picture

Ahh, I see what you mean now.

Yes, checking for the existence of the module is better than the profile, I think.

Thanks!

colan’s picture