Development: 'dict object' has no attribute 'db_name'


#1

Local Trellis head is at db0c068de7197c14132a42ab398c4c9b3cf9fcb3;

TASK [wordpress-setup : Create database of sites] ******************************
System info:
  Ansible 2.0.2.0; Darwin
  Trellis at "Add `vault_users` for easier password management"
---------------------------------------------------
'dict object' has no attribute 'db_name'
fatal: [default]: FAILED! => {"failed": true}
	to retry, use: --limit @/www/teamrubicon/trusa.org/trellis/dev.retry

PLAY RECAP *********************************************************************
default                    : ok=56   changed=1    unreachable=0    failed=1

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

group_vars/development/wordpress_sites.yml:

wordpress_sites:
  teamrubiconusa.org:
    site_hosts:
      - canonical: tr.dev
        # redirects:
        #  - www.example.dev
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    admin_email: jeremy.miller@teamrubiconusa.org
    multisite:
      enabled: false
    ssl:
      enabled: false
      provider: self-signed
    cache:
      enabled: false
    env:
      ACF_PRO_KEY: "{{ ACF_PRO_KEY }}"

group_vars/development/vault.yml:

# Documentation: https://roots.io/trellis/docs/vault/
vault_mysql_root_password: devpw

# Variables to accompany `group_vars/development/wordpress_sites.yml`
# Note: the site name (`example.com`) must match up with the site name in the above file.
vault_wordpress_sites:
  teamrubiconusa.org:
    admin_password: admin
    env:
      db_password: tr_dbpassword

Seems like it should be pulling db_name: "{{ item.key | underscore }}_{{ env }}" from group_vars/all/helpers.yml…any thoughts?


#3

Seems like the only customization you’ve made to the config is setting ACF_PRO_KEY under env.

I just tried a new vagrant box with that as well and everything worked correctly.

Did you manually apply Trellis updates or was that a fresh clone? My first thought is that if you did a manual update/merge that something was missed.


#4

I’ve done some debugging, and I’ve narrowed down the issue to something related to composer - when I run vagrant up, TASK [wordpress-install : Install Dependencies with Composer] fails with the following error:

PHP Fatal error: Class 'Composer\\Installers\\BaseInstaller' not found in /srv/www/teamrubiconusa.org/current/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php on line 4

If I ssh into the vagrant box, the $ composer works in any directory aside from /srv/www/teamrubiconusa.org/current/; in that directory $ composer (or any composer command) returns the following:

PHP Fatal error:  Class 'Composer\Installers\BaseInstaller' not found in /srv/www/teamrubiconusa.org/current/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php on line 4
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/composer:0
PHP   2. require() /usr/local/bin/composer:24
PHP   3. Composer\Console\Application->run() phar:///usr/local/bin/composer/bin/composer:43
PHP   4. Symfony\Component\Console\Application->run() phar:///usr/local/bin/composer/src/Composer/Console/Application.php:104
PHP   5. Composer\Console\Application->doRun() phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:123
PHP   6. Composer\Console\Application->getPluginCommands() phar:///usr/local/bin/composer/src/Composer/Console/Application.php:135
PHP   7. Composer\Console\Application->getComposer() phar:///usr/local/bin/composer/src/Composer/Console/Application.php:430
PHP   8. Composer\Factory::create() phar:///usr/local/bin/composer/src/Composer/Console/Application.php:318
PHP   9. Composer\Factory->createComposer() phar:///usr/local/bin/composer/src/Composer/Factory.php:554
PHP  10. Composer\Factory->purgePackages() phar:///usr/local/bin/composer/src/Composer/Factory.php:382
PHP  11. Composer\Installer\InstallationManager->isPackageInstalled() phar:///usr/local/bin/composer/src/Composer/Factory.php:537
PHP  12. Composer\Installer\InstallationManager->getInstaller() phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:127
PHP  13. Composer\Installers\Installer->supports() phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:105
PHP  14. Composer\Installers\Installer->getLocationPattern() /srv/www/teamrubiconusa.org/current/vendor/composer/installers/src/Composer/Installers/Installer.php:121
PHP  15. spl_autoload_call() /srv/www/teamrubiconusa.org/current/vendor/composer/installers/src/Composer/Installers/Installer.php:161
PHP  16. Composer\Autoload\ClassLoader->loadClass() /srv/www/teamrubiconusa.org/current/vendor/composer/installers/src/Composer/Installers/Installer.php:161
PHP  17. Composer\Autoload\includeFile() phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php:301
PHP  18. include() phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php:412

Fatal error: Class 'Composer\Installers\BaseInstaller' not found in /srv/www/teamrubiconusa.org/current/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php on line 4

Call Stack:
    0.0001     352096   1. {main}() /usr/local/bin/composer:0
    0.0059     568960   2. require('phar:///usr/local/bin/composer/bin/composer') /usr/local/bin/composer:24
    0.0222    3082608   3. Composer\Console\Application->run() phar:///usr/local/bin/composer/bin/composer:43
    0.0238    3319632   4. Symfony\Component\Console\Application->run() phar:///usr/local/bin/composer/src/Composer/Console/Application.php:104
    0.0243    3389208   5. Composer\Console\Application->doRun() phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:123
    0.0262    3495904   6. Composer\Console\Application->getPluginCommands() phar:///usr/local/bin/composer/src/Composer/Console/Application.php:135
    0.0262    3495960   7. Composer\Console\Application->getComposer() phar:///usr/local/bin/composer/src/Composer/Console/Application.php:430
    0.0262    3495960   8. Composer\Factory::create() phar:///usr/local/bin/composer/src/Composer/Console/Application.php:318
    0.0262    3496000   9. Composer\Factory->createComposer() phar:///usr/local/bin/composer/src/Composer/Factory.php:554
    0.0877    7085304  10. Composer\Factory->purgePackages() phar:///usr/local/bin/composer/src/Composer/Factory.php:382
    0.0877    7085304  11. Composer\Installer\InstallationManager->isPackageInstalled() phar:///usr/local/bin/composer/src/Composer/Factory.php:537
    0.0877    7085304  12. Composer\Installer\InstallationManager->getInstaller() phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:127
    0.0877    7085352  13. Composer\Installers\Installer->supports() phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:105
    0.0877    7085392  14. Composer\Installers\Installer->getLocationPattern() /srv/www/teamrubiconusa.org/current/vendor/composer/installers/src/Composer/Installers/Installer.php:121
    0.0877    7085520  15. spl_autoload_call() /srv/www/teamrubiconusa.org/current/vendor/composer/installers/src/Composer/Installers/Installer.php:161
    0.0877    7085664  16. Composer\Autoload\ClassLoader->loadClass() /srv/www/teamrubiconusa.org/current/vendor/composer/installers/src/Composer/Installers/Installer.php:161
    0.0880    7085824  17. Composer\Autoload\includeFile() phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php:301
    0.0885    7087936  18. include('/srv/www/teamrubiconusa.org/current/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php') phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php:412

So it seems to be a namespace issue; I can’t figure out how to debug beyond this, and I’ve tried reverting to commits that worked before, but I get the same output. Any thoughts?

FYI, all package requirements (as listed on the Install Trellis page) are satisfied.


#5

Any thoughts here? I know this isn’t an issue with the stock install, as I’ve made some adjustments here and there, but I’m not even sure how to debug this further.

I’ve tried reinstalling the ansible-galaxy requirements, running composer self-update, composer diagnose, etc.

If I go to example.com/site (either in the vagrant box or locally) and run any composer command (composer, composer update, etc.), I just get this:

PHP Fatal error: Class 'Composer\Installers\BaseInstaller' not found in /www/teamrubicon/trusa.org/site/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php on line 4


#6

When I google this error I see suggestions to try removing the vendor folder
(example.com/site/vendor on host or /srv/www/teamrubiconusa.org/current/vendor in VM) and try the retry the composer commands.

I wonder if that would help. Perhaps you’ve tried it.


#7

Somehow I lost a number of the files in /site/wp/ and /site/vendor, though I’m not clear how. Copying them from a working install fixed the problem.

Thanks for the suggestion!


#8

Going to bump this one just to say you can get this same error message simply by not having your group_vars/all/ folder up to date.