Answers.Body: <p>Turns out that when running in saltstack drush can't resolve the right environment variables to find ~/.drush. I put civicrm.drush.inc in my drush/commands directory and it fixed the problem.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-27T15:38:59.730Z
Answers.LastActivityDate: 2015-10-27T15:38:59.730Z
Answers.UserDisplayName: njvb
Answers.Body: <p>I've seen this behaviour occasionally on CiviCRM sites where CiviCRM is already installed, and it frequently clears up by use of <code>drush cc drush</code> or <code>drush rr</code> (<a href="https://www.drupal.org/project/registry_rebuild" rel="nofollow">registry-rebuild</a>).</p>
  
  <p>If you're installing CiviCRM on a "fresh" Drupal site, the Drush commands may not be available until the module is enabled as you say. In that case you might need to install CiviCRM's Drush additions to <code>~/.drush/</code> or the commands directory of your installed Drush codebase (eg <code>/usr/local/src/drush/commands</code>).</p>
  
  <p>Worth a look into how <a href="https://www.drupal.org/project/provision_civicrm" rel="nofollow">Provision CiviCRM</a> handles this as well, since it's certainly capable of installing CiviCRM via Drush.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-26T22:27:44.930Z
Answers.Text: Thanks for the answer. I have already tried drush cc and have placed civicrm.drush.inc in ~/.drush. Unfortunately constraints in my deployment environment do not let me use anything other than saltstack.
Answers.UserDisplayName: njvb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-26T22:17:25.363Z
Answers.LastActivityDate: 2015-10-26T22:17:25.363Z
Answers.UserDisplayName: Chris Burgess
Answers.Body: <p>What version of Drush were you using? It did not work for me with 7.x.dev but but did with 8.1.0.</p>
  
  <p>I also passed the following parameter to drush <code>--include=/var/www/drupal/sites/all/modules/civicrm/drupal/drush</code> which meant that I didn't have to </p>
  
  <blockquote>
    <p>[...] put civicrm.drush.inc in my drush/commands directory</p>
  </blockquote>
  
  <p>as you mentioned that you had to in your answer.</p>
  
  <p><strong>Note:</strong> the --include option to drush expects the directory containing the configuration file, not the configuration file itself.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-04T16:21:50.650Z
Answers.LastActivityDate: 2017-06-04T16:35:04.040Z
Answers.LastEditDate: 2017-06-04T16:35:04.040Z
Answers.UserDisplayName: michaelmcandrew
Body: <p>I am trying to use saltstack to provision a centos 6.7 system that has drupal and civicrm. I have civicrm as a tar ball that I extract into <code>sites/all/modules</code> before trying to install. I am able to do all the provisioning without problem until I need to install civicrm with drush by running:</p>
  
  <pre><code>drush civicrm-install
  </code></pre>
  
  <p>This command works perfectly fine when I ssh into the target machine and execute it directly in the shell, but when the command is executed through saltstack I get this error message:</p>
  
  <pre><code>Command civicrm-install needs the following module(s) enabled to run: civicrm.
  The drush command 'civicrm-install' could not be executed.
  </code></pre>
  
  <p>I have already tried clearing the drush cache using <code>drush cc</code>, I have tried putting the command in a bash script and running the bash script from salt, and I have already placed <code>civicrm.drush.inc</code> in <code>~/.drush</code> with no luck. Can somebody tell me what drush is missing from the environment in order to execute correctly?</p>
  
  <p>[edit] More detail on what I have already tried for clarity.</p>
  
Tags: <drupal><drush>
Title: drush requires civicrm to be enabled when installing in saltstack
ThreadText: # drush requires civicrm to be enabled when installing in saltstack
  
  (Asked by: username_0 on 2015-10-26)
  
  I am trying to use saltstack to provision a centos 6.7 system that has drupal and civicrm. I have civicrm as a tar ball that I extract into sites/all/modules before trying to install. I am able to do all the provisioning without problem until I need to install civicrm with drush by running:
  drush civicrm-install
  
  This command works perfectly fine when I ssh into the target machine and execute it directly in the shell, but when the command is executed through saltstack I get this error message:
  Command civicrm-install needs the following module(s) enabled to run: civicrm.
  The drush command 'civicrm-install' could not be executed.
  
  I have already tried clearing the drush cache using drush cc, I have tried putting the command in a bash script and running the bash script from salt, and I have already placed civicrm.drush.inc in ~/.drush with no luck. Can somebody tell me what drush is missing from the environment in order to execute correctly?
  [edit] More detail on what I have already tried for clarity.
  
  **Tags:** drupal, drush
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_0 on 2015-10-27. Score: 3
  
  Turns out that when running in saltstack drush can't resolve the right environment variables to find ~/.drush. I put civicrm.drush.inc in my drush/commands directory and it fixed the problem.
  
  
  ---
  
  ### Answer by username_1 on 2015-10-26. Score: 2
  
  I've seen this behaviour occasionally on CiviCRM sites where CiviCRM is already installed, and it frequently clears up by use of `drush cc drush` or `drush rr` ([registry-rebuild](https://www.drupal.org/project/registry_rebuild)).
  
  If you're installing CiviCRM on a "fresh" Drupal site, the Drush commands may not be available until the module is enabled as you say. In that case you might need to install CiviCRM's Drush additions to `~/.drush/` or the commands directory of your installed Drush codebase (eg `/usr/local/src/drush/commands`).
  
  Worth a look into how [Provision CiviCRM](https://www.drupal.org/project/provision_civicrm) handles this as well, since it's certainly capable of installing CiviCRM via Drush.
  
  > **Comments:**
  > **username_0**: Thanks for the answer. I have already tried drush cc and have placed civicrm.drush.inc in ~/.drush. Unfortunately constraints in my deployment environment do not let me use anything other than saltstack.  
  
  ---
  
  ### Answer by username_2 on 2017-06-04. Score: 0
  
  What version of Drush were you using? It did not work for me with 7.x.dev but but did with 8.1.0.
  
  I also passed the following parameter to drush `--include=/var/www/drupal/sites/all/modules/civicrm/drupal/drush` which meant that I didn't have to
  
  > [...] put civicrm.drush.inc in my drush/commands directory
  
  as you mentioned that you had to in your answer.
  
  **Note:** the --include option to drush expects the directory containing the configuration file, not the configuration file itself.
  
  
  ---
  
  