molecule: Compatibility with Ansible devel (2.8) broken

Issue Type

  • Bug report

Since 7e92ff823e2bf97ee33c1b7ff87bb8acecb5ae77, molecule doesn’t work with ansible devel version.

Error is:

        ==================================== ERRORS ====================================
        ____________________ ERROR collecting tests/test_default.py ____________________
        tests/test_default.py:6: in <module>
            os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
        /home/travis/build/ansible/molecule/.tox/ansibledevel-functional/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'

Issue was reported by @maxamillion on #ansible-molecule channel:

@maxamillion | can anyone advise what I'm doing wrong here? https://paste.fedoraproject.org/paste/6Q4OJP4CQxfzGU0HzqTpog
@maxamillion | or what I might be missing                                                                               
@maxamillion | I *think* it's a bug in testinfra, but I'm not certain                                                   
       Pilou | maxamillion: it seems base_parser has been removed (7e92ff823e2bf97ee33c1b7ff87bb8acecb5ae77)            
      @bcoca | maxamillion: tanner was saying this last week, ansible changed the internal options parser               
      @bcoca | and molecule uses it directly, which now breaks with devel                                               
      @bcoca | you can still use with <=2.7                                                                             
@maxamillion | oh right, I vaguely remember that conversation                                                           

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 11
  • Comments: 22 (19 by maintainers)

Commits related to this issue

Most upvoted comments

I got around this by adding testinfra to travis.yml which installed testinfra 3.0+

  • pip install testinfra molecule docker

Ansible 2.8 dropped 😱 😱 😱

Need to get the testinfra patch fixed and fix the CI to build 2.8 proper (without fails).

Basically testinfra uses private API which is not (and never was) guaranteed to be stable. The right way, as for now, is to call CLI. The long-term fix would be to use ansible-runner which (I heard so) is going to be ready at some point in future (aka probably soon).

Using molecule’s docker image here, and we need to add the following line to the dockerfile to make it work with ansible 2.8 and testinfra 3.x:

RUN pip install "ansible==2.8.0" "testinfra==3.0.4"

https://github.com/philpep/testinfra/issues/401#issuecomment-489434741

Hi, I just released 3.0.0 with the new ansible runner which should be compatible with ansible 2.8 please sse the changelog here: https://testinfra.readthedocs.io/en/latest/changelog.html

And testinfra is now 3.0.3:

@lwm this is indeed the wise thing to do 😃 I proposed a pull request to testinfra but it is not trivial and I suspect it will be some time before this is fixed.