forumone / web-starter

Starting place for developing Drupal, Wordpress and other web applications
http://forumone.github.io/web-starter/
22 stars 11 forks source link

Vagrant provision fails when installing Behat with: composer install returned 1 instead of one of [0] #182

Closed arh1 closed 5 years ago

arh1 commented 8 years ago

Hmm, on a clean web-starter installation today using the generator, vagrant provision is failing with the following error:

Error: composer install returned 1 instead of one of [0]
Error: /Stage[main]/Forumone::Behat/Exec[web-starter-behat::composer]/returns: change from notrun to 0 failed: composer install returned 1 instead of one of [0]
Error: bundle returned 5 instead of one of [0]
Error: /Stage[main]/Forumone::Ruby/Exec[vagrant bundle]/returns: change from notrun to 0 failed: bundle returned 5 instead of one of [0]

Just stubbing out an issue for the time being...

Possibly related:

wwhurley commented 8 years ago

Can you try running vagrant provision again? I was unable to reproduce this locally.

arh1 commented 8 years ago

Yeah, tried that a few times now with the same result.

Still poking on my end, but here's a little more info...

Generator versions:

ahieb@ahieb-pc:~/develop/sandbox/web-starter-behat$ npm ls -g --depth=1 2>/dev/null | grep generator-
│ ├── generator-web-starter@0.4.3
├─┬ generator-hedley@0.1.7
├─┬ generator-web-starter@0.4.3
│ ├── generator-web-starter-capistrano@0.1.1
│ ├── generator-web-starter-drupal@0.1.2
│ ├── generator-web-starter-puppet@0.1.0
│ ├── generator-web-starter-wordpress@0.1.2
ahieb@ahieb-pc:~/develop/sandbox/web-starter-behat$ 

Here are the contents of my .yo-rc.json (I just added the repo from a recent project of mine for testing, scrubbed out here) :

  "generator-web-starter": {
    "name": "Behat web-starter sandbox",
    "repository": "git@github.com:forumone/[repo-name].git",
    "plugins": [
      "web-starter-drupal:web-starter",
      "web-starter-capistrano:web-starter",
      "web-starter-puppet:web-starter"
    ],  
    "refspec": "1.1.x"
  },  
  "generator-web-starter-drupal": {
    "features": true,
    "cmi": false,
    "drupal_theme": "hub"
  },  
  "generator-web-starter-capistrano": {
    "deploy_via": "rsync",
    "keep_releases": 3
  },  
  "generator-web-starter-puppet": {
    "host": "f1dev",
    "vhost": "/vagrant/public",
    "database": true,
    "db_name": "web",
    "db_user": "web",
    "php_version": "php55u",
    "solr": true
  }
}

I know I'm running older versions of some of these tools than most folks... Not sure which would be relevant, tho?

ahieb@ahieb-pc:~/develop/sandbox/web-starter-behat$ vagrant -v
Vagrant 1.6.2
ahieb@ahieb-pc:~/develop/sandbox/web-starter-behat$ yo --version
1.4.8
ahieb@ahieb-pc:~/develop/sandbox/web-starter-behat$ node -v
v0.10.25
ahieb@ahieb-pc:~/develop/sandbox/web-starter-behat$
arh1 commented 8 years ago

And hmm, inside the VM I see:

[vagrant@localhost ~]$ drush --version
 Drush Version   :  7.1.0 

[vagrant@localhost ~]$ composer --version
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Composer version 1.0-dev (7c62e2b5346a6a656dd9587203719e35bb768056) 2016-03-16 08:47:37
[vagrant@localhost ~]$
arh1 commented 8 years ago

Aha. Vagrant can't create the subdirectories it needs to under /vagrant/tests/behat . From my Vagrant provision log:

==> default: Notice: /Stage[main]/Forumone::Drush/File[/opt/drush-7.1.0/lib]/owner: owner changed 'root' to 'vagrant'
==> default: Notice: /Stage[main]/Forumone::Drush/Exec[forumone::drush::composer]/returns: executed successfully
==> default: Notice: /Stage[main]/Forumone::Behat/Exec[web-starter-behat::composer]/returns: You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
==> default: Notice: /Stage[main]/Forumone::Behat/Exec[web-starter-behat::composer]/returns: Loading composer repositories with package information
==> default: Notice: /Stage[main]/Forumone::Behat/Exec[web-starter-behat::composer]/returns: Updating dependencies (including require-dev)
==> default: Notice: /Stage[main]/Forumone::Behat/Exec[web-starter-behat::composer]/returns: 
==> default: Notice: /Stage[main]/Forumone::Behat/Exec[web-starter-behat::composer]/returns:                                                                         
==> default: Notice: /Stage[main]/Forumone::Behat/Exec[web-starter-behat::composer]/returns:   [RuntimeException]                                                    
==> default: Notice: /Stage[main]/Forumone::Behat/Exec[web-starter-behat::composer]/returns:   /vagrant/tests/behat/vendor does not exist and could not be created.  
==> default: Notice: /Stage[main]/Forumone::Behat/Exec[web-starter-behat::composer]/returns:                                                                         
==> default: Notice: /Stage[main]/Forumone::Behat/Exec[web-starter-behat::composer]/returns: 
==> default: Notice: /Stage[main]/Forumone::Behat/Exec[web-starter-behat::composer]/returns: install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...
==> default: Error: composer install returned 1 instead of one of [0]
==> default: Error: /Stage[main]/Forumone::Behat/Exec[web-starter-behat::composer]/returns: change from notrun to 0 failed: composer install returned 1 instead of one of [0]
generalconsensus commented 8 years ago

@arh1 can you try adding this to your local setup and see if this fixes it?

https://github.com/generalconsensus/puppet-forumone/commit/46e18c7979bad14e625162c62daed6dd74662411

Technically you can just grab my repo instead of the F1 repo by replacing:

mod "forumone/forumone",
  :git => "https://github.com/forumone/puppet-forumone.git",
  :ref => "1.1.36"

with

mod "forumone/forumone",
  :git => "https://github.com/generalconsensus/puppet-forumone.git",
  :ref => "1.1.47"
arh1 commented 8 years ago

Per Dan and my chat, that change gave us progress but no cigar. Vagrant no longer throws errors during provision, and the appropriate subdirectories are created, but composer does not install behat.

generalconsensus commented 8 years ago

@arh1 Andy I believe the issue is the permissions surrounding the user that is executing the composer update command. Remove this line locally:

  1. https://github.com/forumone/puppet-forumone/blob/1.1.x/manifests/behat.pp#L202
  2. comment out this line: https://github.com/forumone/web-starter/blob/1.1.x/Vagrantfile#L98
  3. Re-run: vagrant provision

@wwhurley How do you feel about a PR removing this line: https://github.com/forumone/puppet-forumone/blob/1.1.x/manifests/behat.pp#L202. It doesn't solve the issue as to why, but it does solve @arh1 problem...

arh1 commented 8 years ago

Success!

I forked generalconsensus/puppet-forumone repo (I know it's a head of forumone/puppet-forumone), and removed: https://github.com/generalconsensus/puppet-forumone/blob/1.1.x/manifests/behat.pp#L228

I left my Vagrantfile as-is for starters, re-ran provision, and voila! It looks like I now have a completed Behat installation:

[vagrant@localhost behat]$ bin/behat --version
Behat version 2.5-dev
[vagrant@localhost behat]$

Created a PR here, fwiw, but I'll leave that up to you @generalconsensus and @wwhurley : https://github.com/generalconsensus/puppet-forumone/pull/1

Thanks for digging, Dan!

generalconsensus commented 8 years ago

@wwhurley Not sure why behat fails but drush succeeds with the same command. William I was hesitant to remove that specific line in question, as I recall you asking me to insert line to match the Drush manifest file. If removing line is acceptable to you Ill add a PR

arh1 commented 8 years ago

Also, @wwhurley , fwiw, still getting some permissions-related errors during provisioning. I'm assuming this is not related, but noting here in case I'm wrong:

DEBUG: Tue Mar 22 16:25:11 +0000 2016: Looking for data source common
Error: Could not find dependency File[/vagrant] for File[/vagrant/tests]

 INFO warden: Beginning recovery process...
 INFO warden: Calling recover: #<Vagrant::Action::Builtin::Call:0x00000000faac30>
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO environment: Released process lock: machine-action-57476d38682f03dd024433e541492909
 INFO environment: Running hook: environment_unload
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: #<Vagrant::Action::Builder:0x000000013327b8>
ERROR vagrant: Vagrant experienced an error! Details:
ERROR vagrant: #<Vagrant::Errors::VagrantError: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

FACTER_host_uid='1000' FACTER_host_gid='1000' FACTER_vagrant_user='ahieb' puppet apply --verbose --hiera_config=/tmp/vagrant-puppet-3/hiera.yaml --color=false --manifestdir /tmp/vagrant-puppet-3/manifests --detailed-exitcodes /tmp/vagrant-puppet-3/manifests/init.pp

Stdout from the command:

Info: Loading facts in /etc/puppet/modules/firewall/lib/facter/iptables_persistent_version.rb
Info: Loading facts in /etc/puppet/modules/firewall/lib/facter/iptables_version.rb
Info: Loading facts in /etc/puppet/modules/firewall/lib/facter/ip6tables_version.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/service_provider.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/package_provider.rb
Info: Loading facts in /etc/puppet/modules/epel/lib/facter/os_maj_version.rb
Info: Loading facts in /etc/puppet/modules/forumone/lib/facter/rootless.rb
Info: Loading facts in /etc/puppet/modules/concat/lib/facter/concat_basedir.rb
Info: Loading facts in /etc/puppet/modules/ruby/lib/facter/gemhome.rb
Info: Loading facts in /etc/puppet/modules/percona/lib/facter/meminbytes.rb
Info: Loading facts in /etc/puppet/modules/percona/lib/facter/mysql_facts.rb

Stderr from the command:

Could not retrieve puppet_user: can't find user for 1000
Could not retrieve puppet_user: can't find user for 1000
Could not retrieve puppet_group: can't find group for 1000
Could not retrieve puppet_group: can't find group for 1000
Could not retrieve puppet_user_home: can't find user for 1000
Could not retrieve puppet_user_home: can't find user for 1000
WARN: Tue Mar 22 16:25:09 +0000 2016: Not using Hiera::Puppet_logger. It does not report itself to be suitable.
DEBUG: Tue Mar 22 16:25:09 +0000 2016: Hiera YAML backend starting