0

I'm trying to provision a VM with vagrant 1.7.4 and puppet 4.2.1. Everything looks ok to the moment I'm installing drush.

class tools {

  # package install list
  $packages = [
    "curl",
    "vim",
    "htop",
    "git-core"
  ]

  # install packages
  package { $packages:
    ensure => present,
    require => Exec["apt-get update"]
  }

  exec { 'composer-install':
    command => 'curl -sS https://getcomposer.org/installer | php && sudo mv composer.phar /usr/local/bin/composer',
    path    => '/usr/bin:/usr/sbin',
    require => Package['curl'],
  }

  exec { 'drush-install':
    command => 'composer global require drush/drush:dev-master',
    environment => ["COMPOSER_HOME=/usr/local/bin/composer"],
    path    => '/usr/bin:/usr/local/bin:~/.composer/',
    require => Exec['composer-install']
  }

}

Composer is installed successfully but drush fails. Below are the logs of operations executed:

==> default: Debug: Exec[composer-install](provider=posix): Executing 'curl -sS https://getcomposer.org/installer | php && sudo mv composer.phar /usr/local/bin/composer'
==> default: Debug: Executing: 'curl -sS https://getcomposer.org/installer | php && sudo mv composer.phar /usr/local/bin/composer'
==> default: Notice: /Stage[main]/Tools/Exec[composer-install]/returns: executed successfully
==> default: Debug: /Stage[main]/Tools/Exec[composer-install]: The container Class[Tools] will propagate my refresh event
==> default: Debug: Exec[drush-install](provider=posix): Executing 'composer global require drush/drush:dev-master'
==> default: Debug: Executing: 'composer global require drush/drush:dev-master'
==> default: Notice: /Stage[main]/Tools/Exec[drush-install]/returns: 
==> default: Notice: /Stage[main]/Tools/Exec[drush-install]/returns: 
==> default: Notice: /Stage[main]/Tools/Exec[drush-install]/returns:                                        
==> default: Notice: /Stage[main]/Tools/Exec[drush-install]/returns:   [ErrorException]                     
==> default: Notice: /Stage[main]/Tools/Exec[drush-install]/returns:   chdir(): Not a directory (errno 20)  
==> default: Notice: /Stage[main]/Tools/Exec[drush-install]/returns:                                        
==> default: Notice: /Stage[main]/Tools/Exec[drush-install]/returns: 
==> default: Notice: /Stage[main]/Tools/Exec[drush-install]/returns: 
==> default: Notice: /Stage[main]/Tools/Exec[drush-install]/returns: global command-name [args1] ... [argsN]
==> default: Debug: Class[Tools]: Resource is being skipped, unscheduling all events
==> default: Error: composer global require drush/drush:dev-master returned 1 instead of one of [0]
==> default: Error: /Stage[main]/Tools/Exec[drush-install]/returns: change from notrun to 0 failed: composer global require drush/drush:dev-master returned 1 instead of one of [0]
==> default: Info: Class[Tools]: Unscheduling all events on Class[Tools]
==> default: Debug: Stage[main]: Resource is being skipped, unscheduling all events
==> default: Info: Stage[main]: Unscheduling all events on Stage[main]
==> default: Debug: Finishing transaction 15011420
==> default: Debug: Storing state
==> default: Info: Creating state file /opt/puppetlabs/puppet/cache/state/state.yaml
==> default: Debug: Stored state in 0.01 seconds
==> default: Notice: Applied catalog in 154.95 seconds
==> default: Debug: Applying settings catalog for sections reporting, metrics
==> default: Debug: Finishing transaction 35207340
==> default: Debug: Received report to process from demo.local
==> default: Debug: Evicting cache entry for environment 'local'
==> default: Debug: Caching environment 'local' (ttl = 0 sec)
==> default: Debug: Processing report from demo.local with processor Puppet::Reports::Store
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Later edit:

added --verbose to composer command:

Exception trace:
 () at phar:///usr/local/bin/composer/src/Composer/Command/GlobalCommand.php:74
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 chdir() at phar:///usr/local/bin/composer/src/Composer/Command/GlobalCommand.php:74
 Composer\Command\GlobalCommand->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:874
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:146
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:82
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
 require() at /usr/local/bin/composer:25

Am I doing something wrong?

Radu
  • 1,159
  • 3
  • 22
  • 40
  • can you run puppet with debug option `puppet.options = "--verbose --debug"` and output where there is error ? also in your path variable, it should be `~/.composer` not `~/.composer/` – Frederic Henri Sep 09 '15 at 13:05
  • updated logs; will try without the trailing slash – Radu Sep 09 '15 at 13:09
  • ok so seems its really an error with `composer global require drush/drush:dev-master` if you ssh into the vm and run the same command, does it work ? – Frederic Henri Sep 09 '15 at 13:11
  • yes - running the command into the VM does the trick – Radu Sep 09 '15 at 13:13
  • the trailing slash wasn't the issue - still not working – Radu Sep 09 '15 at 13:14
  • ok I dont know drush but could be permission issue, can you add to the exec the user (vagrant or the ssh user, `user => "vagrant"` ) or should be run by root ? – Frederic Henri Sep 09 '15 at 13:27

0 Answers0