Skip to content

Commit

Permalink
Fixing bug in Doctor's VM config check.
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmash committed Sep 27, 2016
1 parent 1760c2f commit cb3a889
Showing 1 changed file with 35 additions and 32 deletions.
67 changes: 35 additions & 32 deletions src/Drush/Command/BltDoctorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,40 +581,42 @@ protected function checkDrupalVmConfig() {
}
if ($this->drushAliasesFileExists()) {
$local_alias_id = $this->config['drush']['aliases']['local'];
if (empty($this->drushAliases[$local_alias_id])) {
$this->logError("The drush alias assigned to drush.aliases.local does not exist in your drush aliases file.");
$this->logErrorDetail("drush.aliases.local is set to @$local_alias_id");
$this->logErrorDetail("Looked in " . $this->repoRoot . '/drush/site-aliases/aliases.drushrc.php');
$this->logErrorDetail();
$passed = FALSE;
}
else {
$local_alias = $this->drushAliases[$local_alias_id];
if ($local_alias['remote-host'] != $this->drupalVmConfig['vagrant_hostname']) {
$this->logError("remote-host for @$local_alias_id drush alias does not match vagrant_hostname for DrupalVM.");
$this->logErrorDetail("remote-host is set to {$local_alias['remote-host']} for @$local_alias_id");
$this->logErrorDetail("vagrant_hostname is set to {$this->drupalVmConfig['vagrant_hostname']} for DrupalVM.");
$this->logErrorDetail("{$local_alias['remote-host']} != {$this->drupalVmConfig['vagrant_hostname']}");
$this->logErrorDetail();
$passed = FALSE;
}
$parsed_uri = parse_url($local_alias['uri']);
if ($parsed_uri['host'] != $this->drupalVmConfig['vagrant_hostname']) {
$this->logError("uri for @$local_alias_id drush alias does not match vagrant_hostname for DrupalVM.");
$this->logErrorDetail("uri is set to {$local_alias['uri']} for @$local_alias_id");
$this->logErrorDetail("vagrant_hostname is set to {$this->drupalVmConfig['vagrant_hostname']} for DrupalVM.");
$this->logErrorDetail("{$local_alias['uri']} != {$this->drupalVmConfig['vagrant_hostname']}");
if ($local_alias_id !== 'self') {
if (empty($this->drushAliases[$local_alias_id])) {
$this->logError("The drush alias assigned to drush.aliases.local does not exist in your drush aliases file.");
$this->logErrorDetail("drush.aliases.local is set to @$local_alias_id");
$this->logErrorDetail("Looked in " . $this->repoRoot . '/drush/site-aliases/aliases.drushrc.php');
$this->logErrorDetail();
$passed = FALSE;
}
$expected_root = $this->drupalVmConfig['drupal_composer_install_dir'] . '/docroot';
if ($local_alias['root'] != $expected_root) {
$this->logError("root for @$local_alias_id drush alias does not match docroot for DrupalVM.");
$this->logErrorDetail("root is set to {$local_alias['root']} for @$local_alias_id");
$this->logErrorDetail("docroot is set to $expected_root for DrupalVM.");
$this->logErrorDetail("{$local_alias['root']} != $expected_root");
$this->logErrorDetail();
$passed = FALSE;
else {
$local_alias = $this->drushAliases[$local_alias_id];
if ($local_alias['remote-host'] != $this->drupalVmConfig['vagrant_hostname']) {
$this->logError("remote-host for @$local_alias_id drush alias does not match vagrant_hostname for DrupalVM.");
$this->logErrorDetail("remote-host is set to {$local_alias['remote-host']} for @$local_alias_id");
$this->logErrorDetail("vagrant_hostname is set to {$this->drupalVmConfig['vagrant_hostname']} for DrupalVM.");
$this->logErrorDetail("{$local_alias['remote-host']} != {$this->drupalVmConfig['vagrant_hostname']}");
$this->logErrorDetail();
$passed = FALSE;
}
$parsed_uri = parse_url($local_alias['uri']);
if ($parsed_uri['host'] != $this->drupalVmConfig['vagrant_hostname']) {
$this->logError("uri for @$local_alias_id drush alias does not match vagrant_hostname for DrupalVM.");
$this->logErrorDetail("uri is set to {$local_alias['uri']} for @$local_alias_id");
$this->logErrorDetail("vagrant_hostname is set to {$this->drupalVmConfig['vagrant_hostname']} for DrupalVM.");
$this->logErrorDetail("{$local_alias['uri']} != {$this->drupalVmConfig['vagrant_hostname']}");
$this->logErrorDetail();
$passed = FALSE;
}
$expected_root = $this->drupalVmConfig['drupal_composer_install_dir'] . '/docroot';
if ($local_alias['root'] != $expected_root) {
$this->logError("root for @$local_alias_id drush alias does not match docroot for DrupalVM.");
$this->logErrorDetail("root is set to {$local_alias['root']} for @$local_alias_id");
$this->logErrorDetail("docroot is set to $expected_root for DrupalVM.");
$this->logErrorDetail("{$local_alias['root']} != $expected_root");
$this->logErrorDetail();
$passed = FALSE;
}
}
}
}
Expand Down Expand Up @@ -667,8 +669,9 @@ protected function checkBehatConfig() {
$this->behatDefaultLocalConfig = Yaml::parse(file_get_contents($this->repoRoot . '/tests/behat/local.yml'));
if ($this->drupalVmEnabled) {
$behat_drupal_root = $this->behatDefaultLocalConfig['local']['extensions']['Drupal\DrupalExtension']['drupal']['drupal_root'];
if (strstr($behat_drupal_root, '/var/www/')) {
if (!strstr($behat_drupal_root, '/var/www/')) {
$this->logError("You have DrupalVM initialized, but drupal_root in tests/behat/local.yml does not reference the DrupalVM docroot.");
$this->logErrorDetail("Behat drupal_root is $behat_drupal_root.");
$this->logErrorDetail();
}
else {
Expand Down

0 comments on commit cb3a889

Please sign in to comment.