question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Molecule verify failed with "AttributeError: 'PlaybookCLI' object has no attribute 'base_parser'"

See original GitHub issue

Issue Type

  • Bug report

Molecule and Ansible details

ansible 2.8.0
  config file = None
  configured module search path = ['/Users/nbchk/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/nbchk/work/ansible/molecule-install-test/.venv/lib/python3.7/site-packages/ansible
  executable location = /Users/nbchk/work/ansible/molecule-install-test/.venv/bin/ansible
  python version = 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 (clang-1001.0.46.3)]
molecule, version 2.20.1

Molecule installation method (one of):

  • pip

Ansible installation method (one of):

  • pip

Detail any linters or test runners used:

  • None

Desired Behavior

molecule verify should run default test example successfully.

Actual Behaviour

molecule verify failed with “AttributeError: ‘PlaybookCLI’ object has no attribute ‘base_parser’”

$ molecule --debug vefiry
--> Validating schema /Users/nbchk/work/ansible/molecule-install-test/molecule/default/molecule.yml.
Validation completed successfully.
--> Test matrix
    
└── default
    └── verify
    
--> Scenario: 'default'
--> Action: 'verify'
--> Executing Testinfra tests found in /Users/nbchk/work/ansible/molecule-install-test/molecule/default/tests/...
DEBUG: ANSIBLE ENVIRONMENT
---
ANSIBLE_CONFIG: /var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/ansible.cfg
ANSIBLE_FILTER_PLUGINS: /Users/nbchk/work/ansible/molecule-install-test/.venv/lib/python3.7/site-packages/molecule/provisioner/ansible/plugins/filters:/var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/plugins/filters:/Users/nbchk/work/ansible/molecule-install-test/plugins/filters
ANSIBLE_LIBRARY: /Users/nbchk/work/ansible/molecule-install-test/.venv/lib/python3.7/site-packages/molecule/provisioner/ansible/plugins/libraries:/var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/library:/Users/nbchk/work/ansible/molecule-install-test/library
ANSIBLE_ROLES_PATH: /var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/roles:/Users/nbchk/work/ansible

DEBUG: MOLECULE ENVIRONMENT
---
MOLECULE_DEBUG: 'True'
MOLECULE_DEPENDENCY_NAME: galaxy
MOLECULE_DRIVER_NAME: vagrant
MOLECULE_ENV_FILE: /Users/nbchk/work/ansible/molecule-install-test/.env.yml
MOLECULE_EPHEMERAL_DIRECTORY: /var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default
MOLECULE_FILE: /Users/nbchk/work/ansible/molecule-install-test/molecule/default/molecule.yml
MOLECULE_INSTANCE_CONFIG: /var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/instance_config.yml
MOLECULE_INVENTORY_FILE: /var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/inventory/ansible_inventory.yml
MOLECULE_LINT_NAME: yamllint
MOLECULE_PROJECT_DIRECTORY: /Users/nbchk/work/ansible/molecule-install-test
MOLECULE_PROVISIONER_LINT_NAME: ansible-lint
MOLECULE_PROVISIONER_NAME: ansible
MOLECULE_SCENARIO_DIRECTORY: /Users/nbchk/work/ansible/molecule-install-test/molecule/default
MOLECULE_SCENARIO_NAME: default
MOLECULE_VERIFIER_LINT_NAME: flake8
MOLECULE_VERIFIER_NAME: testinfra
MOLECULE_VERIFIER_TEST_DIRECTORY: /Users/nbchk/work/ansible/molecule-install-test/molecule/default/tests

DEBUG: SHELL REPLAY
ANSIBLE_CONFIG=/var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/ansible.cfg ANSIBLE_FILTER_PLUGINS=/Users/nbchk/work/ansible/molecule-install-test/.venv/lib/python3.7/site-packages/molecule/provisioner/ansible/plugins/filters:/var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/plugins/filters:/Users/nbchk/work/ansible/molecule-install-test/plugins/filters ANSIBLE_LIBRARY=/Users/nbchk/work/ansible/molecule-install-test/.venv/lib/python3.7/site-packages/molecule/provisioner/ansible/plugins/libraries:/var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/library:/Users/nbchk/work/ansible/molecule-install-test/library ANSIBLE_ROLES_PATH=/var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/roles:/Users/nbchk/work/ansible MOLECULE_DEBUG=True MOLECULE_DEPENDENCY_NAME=galaxy MOLECULE_DRIVER_NAME=vagrant MOLECULE_ENV_FILE=/Users/nbchk/work/ansible/molecule-install-test/.env.yml MOLECULE_EPHEMERAL_DIRECTORY=/var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default MOLECULE_FILE=/Users/nbchk/work/ansible/molecule-install-test/molecule/default/molecule.yml MOLECULE_INSTANCE_CONFIG=/var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/instance_config.yml MOLECULE_INVENTORY_FILE=/var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/inventory/ansible_inventory.yml MOLECULE_LINT_NAME=yamllint MOLECULE_PROJECT_DIRECTORY=/Users/nbchk/work/ansible/molecule-install-test MOLECULE_PROVISIONER_LINT_NAME=ansible-lint MOLECULE_PROVISIONER_NAME=ansible MOLECULE_SCENARIO_DIRECTORY=/Users/nbchk/work/ansible/molecule-install-test/molecule/default MOLECULE_SCENARIO_NAME=default MOLECULE_VERIFIER_LINT_NAME=flake8 MOLECULE_VERIFIER_NAME=testinfra MOLECULE_VERIFIER_TEST_DIRECTORY=/Users/nbchk/work/ansible/molecule-install-test/molecule/default/tests

DEBUG: COMMAND
/Users/nbchk/work/ansible/molecule-install-test/.venv/bin/py.test --connection=ansible --ansible-inventory=/var/folders/x_/5723f_vj5_j8rg8v_5rflzx00000gn/T/molecule/molecule-install-test/default/inventory/ansible_inventory.yml -p no:cacheprovider --debug /Users/nbchk/work/ansible/molecule-install-test/molecule/default/tests/test_default.py -vvv

    ============================= test session starts ==============================
    platform darwin -- Python 3.7.3, pytest-4.6.0, py-1.8.0, pluggy-0.12.0 -- /Users/nbchk/work/ansible/molecule-install-test/.venv/bin/python3.7
    using: pytest-4.6.0 pylib-1.8.0
    setuptools registered plugins:
      testinfra-1.19.0 at /Users/nbchk/work/ansible/molecule-install-test/.venv/lib/python3.7/site-packages/testinfra/plugin.py
    rootdir: /Users/nbchk/work/ansible/molecule-install-test/molecule/default
    plugins: testinfra-1.19.0
    collecting ... 
collecting 0 items / 1 errors                                                  
collected 0 items / 1 errors                                                   
    
    ==================================== ERRORS ====================================
    ____________________ ERROR collecting tests/test_default.py ____________________
    tests/test_default.py:6: in <module>
        os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
    ../../.venv/lib/python3.7/site-packages/testinfra/utils/ansible_runner.py:153: in __init__
        self.cli.options = self.cli.base_parser(
    E   AttributeError: 'PlaybookCLI' object has no attribute 'base_parser'
    =============================== warnings summary ===============================
    /Users/nbchk/work/ansible/molecule-install-test/.venv/lib/python3.7/site-packages/jinja2/utils.py:485
      /Users/nbchk/work/ansible/molecule-install-test/.venv/lib/python3.7/site-packages/jinja2/utils.py:485: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
        from collections import MutableMapping
    
    /Users/nbchk/work/ansible/molecule-install-test/.venv/lib/python3.7/site-packages/jinja2/runtime.py:318
      /Users/nbchk/work/ansible/molecule-install-test/.venv/lib/python3.7/site-packages/jinja2/runtime.py:318: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
        from collections import Mapping
    
    /Users/nbchk/work/ansible/molecule-install-test/.venv/lib/python3.7/site-packages/yaml/constructor.py:126
      /Users/nbchk/work/ansible/molecule-install-test/.venv/lib/python3.7/site-packages/yaml/constructor.py:126: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
        if not isinstance(key, collections.Hashable):
    
    -- Docs: https://docs.pytest.org/en/latest/warnings.html
    !!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
    ===================== 3 warnings, 1 error in 0.74 seconds ======================

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
coaxialcommented, Jun 2, 2019

One temporary fix is to pip install molecule==2.19 ansible==2.7.11.

3reactions
seandstcommented, Jun 5, 2019

The latest testinfra is compatible with molecule, and vice versa. molecule is currently using the latest testinfra on master starting with the merge of #2034, and this issue should be fixed with the next release of molecule.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'PlaybookCLI' object has no attribute 'base_parser'" · Issue ...
molecule verify failed with "AttributeError: 'PlaybookCLI' object has no attribute 'base_parser'". $ molecule --debug vefiry --> Validating ...
Read more >
"PlaybookCLI' object has no attribute 'options'" - trellis
Hey all, I'm new to Trellis and I'm trying to employ to Kinsta for the first time using Trellis. I've followed all the...
Read more >
Molecule test has stopped working with my ansible role
ERROR : 'molecule/*/molecule.yml' glob failed. Exiting. I am using a macbook pro 10.13.6 and below are necessary information.
Read more >
Why am I getting AttributeError: Object has no attribute?
PYTHON : Why am I getting AttributeError : Object has no attribute ? [ Gift : Animated Search Engine ...
Read more >
Configuration — Molecule Documentation
The files are instantiated into a list of Molecule Config objects, ... If not, it will raise an error. ... Determine Ansible verbosity...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found