1

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.

3 Answers 3

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.

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).

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 handles this as well, since it's certainly capable of installing CiviCRM via Drush.

1
  • 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.
    – njvb
    Commented Oct 26, 2015 at 22:27
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.