Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Dependencies with Composer Issue #1263

Closed
4 tasks done
tonybeato opened this issue Jan 13, 2021 · 4 comments · Fixed by #1264
Closed
4 tasks done

Install Dependencies with Composer Issue #1263

tonybeato opened this issue Jan 13, 2021 · 4 comments · Fixed by #1264

Comments

@tonybeato
Copy link

tonybeato commented Jan 13, 2021

Description

Initial "vagrant up" fails at the "Install Dependencies with Composer" task.

Steps to reproduce

  1. Follow steps at https://roots.io/docs/trellis/master/installation/#create-a-project
  2. Edit group_vars/development/wordpress_sites.yml & vault.yml config files
  3. In the trellis directory, run "vagrant up"

Error Message (verbose):

task path: /Users/USERNAME/sites/samplesite.com/trellis/roles/wordpress-install/tasks/main.yml:24
redirecting (type: modules) ansible.builtin.composer to community.general.composer
Using module file /Users/USERNAME/.pyenv/versions/3.8.1/lib/python3.8/site-packages/ansible_collections/community/general/plugins/modules/composer.py
Pipelining is enabled.
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2222 -o 'IdentityFile="/Users/USERNAME/sites/samplesite.com/trellis/.vagrant/machines/default/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vagrant"' -o ConnectTimeout=30 -o ControlPath=/Users/USERNAME/.ansible/cp/055b8f4af0 127.0.0.1 '/bin/sh -c '"'"'python3 && sleep 0'"'"''
<127.0.0.1> (1, b'', b'Traceback (most recent call last):\n  File "<stdin>", line 102, in <module>\n  File "<stdin>", line 94, in _ansiballz_main\n  File "<stdin>", line 40, in invoke_module\n  File "/usr/lib/python3.8/runpy.py", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code\n    exec(code, run_globals)\n  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/ansible_collections/community/general/plugins/modules/composer.py", line 267, in <module>\n  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/ansible_collections/community/general/plugins/modules/composer.py", line 213, in main\n  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/ansible_collections/community/general/plugins/modules/composer.py", line 166, in get_available_options\n  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/ansible/module_utils/basic.py", line 2140, in from_json\n  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads\n    return _default_decoder.decode(s)\n  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode\n    obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode\n    raise JSONDecodeError("Expecting value", s, err.value) from None\njson.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)\n')
<127.0.0.1> Failed to connect to the host via ssh: Traceback (most recent call last):
  File "<stdin>", line 102, in <module>
  File "<stdin>", line 94, in _ansiballz_main
  File "<stdin>", line 40, in invoke_module
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/ansible_collections/community/general/plugins/modules/composer.py", line 267, in <module>
  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/ansible_collections/community/general/plugins/modules/composer.py", line 213, in main
  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/ansible_collections/community/general/plugins/modules/composer.py", line 166, in get_available_options
  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/ansible/module_utils/basic.py", line 2140, in from_json
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
System info:
  Ansible 2.10.4; Vagrant 2.2.7; Darwin
  Trellis version (per changelog): "Validate that `letsencrypt_contact_emails` is a list"
---------------------------------------------------
MODULE FAILURE
See stdout/stderr for the exact error
Traceback (most recent call last):
  File "<stdin>", line 102, in <module>
  File "<stdin>", line 94, in _ansiballz_main
  File "<stdin>", line 40, in invoke_module
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/a
nsible_collections/community/general/plugins/modules/composer.py", line 267,
in <module>
  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/a
nsible_collections/community/general/plugins/modules/composer.py", line 213,
in main
  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/a
nsible_collections/community/general/plugins/modules/composer.py", line 166,
in get_available_options
  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/a
nsible/module_utils/basic.py", line 2140, in from_json
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
The full traceback is:
Traceback (most recent call last):
  File "<stdin>", line 102, in <module>
  File "<stdin>", line 94, in _ansiballz_main
  File "<stdin>", line 40, in invoke_module
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/ansible_collections/community/general/plugins/modules/composer.py", line 267, in <module>
  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/ansible_collections/community/general/plugins/modules/composer.py", line 213, in main
  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/ansible_collections/community/general/plugins/modules/composer.py", line 166, in get_available_options
  File "/tmp/ansible_composer_payload_mfuo3k1v/ansible_composer_payload.zip/ansible/module_utils/basic.py", line 2140, in from_json
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
failed: [default] (item={'key': 'samplesite.com', 'value': {'site_hosts': [{'canonical': 'samplesite.test', 'redirects': ['www.samplesite.test']}], 'local_path': '../site', 'admin_email': '[email protected]', 'multisite': {'enabled': False}, 'ssl': {'enabled': False, 'provider': 'self-signed'}, 'cache': {'enabled': False}}}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "item": {
        "key": "samplesite.com",
        "value": {
            "admin_email": "[email protected]",
            "cache": {
                "enabled": false
            },
            "local_path": "../site",
            "multisite": {
                "enabled": false
            },
            "site_hosts": [
                {
                    "canonical": "samplesite.test",
                    "redirects": [
                        "www.samplesite.test"
                    ]
                }
            ],
            "ssl": {
                "enabled": false,
                "provider": "self-signed"
            }
        }
    },
    "module_stdout": "",
    "rc": 1
}

Reproduces how often:

I've experienced the error consistently on multiple new installs of the latest version of Trellis.

Versions

Trellis v1.7.0

HEAD
Validate that letsencrypt_contact_emails is a list (#1250)
Add config for PHP CLI (#1261)

-macOS Big Sur v11.0.1
-Ansible v2.10.4
-Composer v2.0.8

Additional information

Reverting Trellis version back to [2383753] temporarily solved the issue.

@rkaalma
Copy link
Contributor

rkaalma commented Jan 13, 2021

+1 Having the same behavior.

  • Ubuntu 20.04.1 LTS (5.4.0-58.64-generic 5.4.73)
  • Trellis v1.7.0
  • Ansible v2.9.8
  • Composer v2.0.8

@swalkinshaw
Copy link
Member

swalkinshaw commented Jan 15, 2021

Okay... finally tracked down the problem. I should have paid more attention to the commit you said broke this @tonybeato. I naively thought the 2 PRs merged since then couldn't possibly have broken it. Turns out #1261 broke this.

Summary:

  • Ansible runs composer help install --format-json to get information about the options it supports
  • I ran that command manually and got this output:
composer help install --format=json

Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
  • obviously that isn't valid JSON, which caused the JSON decoding error you saw
  • Add config for PHP CLI #1261 defined the PHP CLI config with that deprecated option which broke it

So before this, we never had a config for PHP CLI and everything was fine 😅

Conclusion: #1264 is the fix for this

@dirad
Copy link

dirad commented Jan 17, 2021

For me, updating and running again still failed in the same spot.

TASK [ntp : Populate service facts.] *******************************************
System info:
  Ansible 2.8.0; Vagrant 2.2.14; Linux
  Trellis version (per changelog): "Fix #1263 - Remove deprecated PHP option `track_errors`"
---------------------------------------------------
Malformed output discovered from systemd list-unit-files: accounts-
daemon.service                enabled         enabled
fatal: [default]: FAILED! => {"changed": false}

RUNNING HANDLER [fail2ban : restart fail2ban] **********************************
changed: [default]

RUNNING HANDLER [ferm : restart ferm] ******************************************
skipping: [default]

PLAY RECAP *********************************************************************
default                    : ok=30   changed=11   unreachable=0    failed=1    skipped=16   rescued=0    ignored=0   

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

@swalkinshaw
Copy link
Member

@dirad that isn't the same spot and it's not related to Composer? It failed on TASK [ntp : Populate service facts.].

See https://discourse.roots.io/t/trellis-malformed-output-discovered-from-systemd-list-unit-files-accounts-daemon-service/19628/6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants