Currently, since http://drupal.org/node/648910 has been fixed, we can dl modules from our feature server by specifying the --source option on the command-line, which is great.

Now, i was wondering if we could improve this a little bit. Would it be possible to specify in our drushrc file a fallback --source option. I mean, if you drush dl projectname without adding the --source option on the command line, drush first tries to dl from drupal.org, and if the project is not found there, drush tries to dl from the specified fallback.

Better maybe might be to have an array of sources to download from. This could default to a single-value array including the drupal.org url. This way, we could also tell drush to first look on our feature server, and if that fails check drupal.org.

Comments

zilverdistel’s picture

Status: Active » Needs review
StatusFileSize
new3.42 KB

Here's a patch that works for me (git apply to origin/7.x-4.x).

In my drushrc.php I specify:

$command_specific['dl']['source'] = array(
  'http://updates.drupal.org/release-history',
  'http://fserver.ourserver.be/fserver'
);
cyberwolf’s picture

Would be a great addition!

kayalion’s picture

subscribe

jonhattan’s picture

Version: All-versions-4.x-dev »
Status: Needs review » Needs work
+++ b/commands/pm/pm.drush.inc
@@ -2085,13 +2085,42 @@ function drush_pm_download_validate() {
+    drush_log(dt('Trying to fetch from !source', array('!source' => $source)), 'warning');

'warning' is not appropiate for a informative message.

+++ b/commands/pm/pm.drush.inc
@@ -2085,13 +2085,42 @@ function drush_pm_download_validate() {
+      // We are not getting here since drupal.org always serves an XML response.
+      drush_set_error('DRUSH_PM_DOWNLOAD_FAILED', dt('Could not download project status information from !url', array('!url' => $url)));
+      continue;

If this and other commented out lines of code are not neccesary just remove them.

Also, this needs documentation in example.drushrc.php.

zilverdistel’s picture

I agree about the warning, but when I use "notice", the message doesn't get displayed. That makes it kinde confusing, because there is a warning if the release is not found on the first server. Maybe we can tackle this by replacing the current warning (Trying to fetch from !source) by the following:

Trying to fetch from fallback server: !source.

This message could have a severity "warning", I think. What do you think?

Concerning the comment you mention: it was allready there, so I'm not sure if my patch should touch it ...

cyberwolf’s picture

IMHO there should be only displayed 1 warning when none of the servers were able to satisfy the dl command. As you explicitly tell Drush through drushrc.php to look on multiple servers, you as a person are aware of that chain already, and there is no reason to explicitly warn the user about one link in the chain not being able to fullfil the request succesfully. Informative messages about the fallback chain are fine though and even recommended for debugging I think.

greg.1.anderson’s picture

Version: » 8.x-6.x-dev
Status: Needs work » Closed (won't fix)
Issue tags: +Needs migration

This issue was marked closed (won't fix) because Drush has moved to Github.

If this feature is still desired, you may copy it to our Github project. For best results, create a Pull Request that has been updated for the master branch. Post a link here to the PR, and please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.