ansible-community/molecule-plugins

Missing dependencies for GCE driver

loozhengyuan opened this issue · 1 comments

I tried to set up the gce driver in a new repo. After installing ansible, molecule, and molecule-plugins[gce], the molecule test command fails with the message Please install the requests library:

  TASK [Wait for instance(s) deletion to complete] *******************************
  failed: [localhost] (item={'failed': 0, 'started': 1, 'finished': 0, 'ansible_job_id': 'j236613821150.1769', 'results_file': '/home/runner/.ansible_async/j236613821150.1769', 'changed': True, 'item': {'image': 'projects/debian-cloud/global/images/family/debian-12', 'machine_type': 'e2-medium', 'name': 'molecule-debian-12-uisp', 'preemptible': True}, 'ansible_loop_var': 'item'}) => {"ansible_job_id": "j236613821150.1769", "ansible_loop_var": "item", "attempts": 1, "changed": false, "finished": 1, "item": {"ansible_job_id": "j236613821150.1769", "ansible_loop_var": "item", "changed": true, "failed": 0, "finished": 0, "item": {"image": "projects/debian-cloud/global/images/family/debian-12", "machine_type": "e2-medium", "name": "molecule-debian-12-uisp", "preemptible": true}, "results_file": "/home/runner/.ansible_async/j236613821150.1769", "started": 1}, "msg": "Please install the requests library", "results_file": "/home/runner/.ansible_async/j236613821150.1769", "started": 1, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
  
  PLAY RECAP *********************************************************************
  localhost                  : ok=1    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

After installing the requests library, it fails with another message Please install the google-auth library:

  TASK [Wait for instance(s) deletion to complete] *******************************
  failed: [localhost] (item={'failed': 0, 'started': 1, 'finished': 0, 'ansible_job_id': 'j899723533337.1829', 'results_file': '/home/runner/.ansible_async/j899723533337.1829', 'changed': True, 'item': {'image': 'projects/debian-cloud/global/images/family/debian-11', 'machine_type': 'e2-medium', 'name': 'molecule-debian-11-unifi', 'preemptible': True}, 'ansible_loop_var': 'item'}) => {"ansible_job_id": "j899723533337.1829", "ansible_loop_var": "item", "attempts": 1, "changed": false, "finished": 1, "item": {"ansible_job_id": "j899723533337.1829", "ansible_loop_var": "item", "changed": true, "failed": 0, "finished": 0, "item": {"image": "projects/debian-cloud/global/images/family/debian-11", "machine_type": "e2-medium", "name": "molecule-debian-11-unifi", "preemptible": true}, "results_file": "/home/runner/.ansible_async/j899723533337.1829", "started": 1}, "msg": "Please install the google-auth library", "results_file": "/home/runner/.ansible_async/j899723533337.1829", "started": 1, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
  
  PLAY RECAP *********************************************************************
  localhost                  : ok=1    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

The issue is finally resolved when both requests and google-auth packages are installed. Looking at pyproject.toml file, it appears that no additional dependencies were declared for gce even though it was required.

Just to add, these were the changes to my pyproject.toml in order to get molecule test to pass:

[tool.poetry.dependencies]
python = "^3.12.2"
ansible = "^9.2.0"
molecule = "^24.2.0"
molecule-plugins = { extras = ["gce"], version = "^23.5.3" }
+ requests = "^2.31.0"
+ google-auth = "^2.28.2"

I noted that molecule-gce that the dependencies required may be much lower but the latest versions are tested working for me.