openstack-charmers / zaza-openstack-tests

OpenStack Charms Functional Test Library for Zaza
Apache License 2.0
7 stars 77 forks source link

LOCAL_SETTINGS assumes python3 support for all test bundles #503

Closed Gleland closed 3 years ago

Gleland commented 3 years ago

LOCAL_SETTINGS is used to import configuration settings during tests for validation. When running the security_checklist action on a unit, I got the following error:

$ juju run-action openstack-dashboard/0 security-checklist --wait
unit-openstack-dashboard-0:
  UnitId: openstack-dashboard/0
  id: "116"
  message: exit status 1
  results:
    ReturnCode: 1
    Stderr: |
      Traceback (most recent call last):
        File "actions/local_settings_to_json.py", line 25, in <module>
          import django.utils.translation as translation
      ImportError: No module named 'django'
      Traceback (most recent call last):
        File "/var/lib/juju/agents/unit-openstack-dashboard-0/charm/actions/security-checklist", line 191, in <module>
          sys.exit(main())
        File "/var/lib/juju/agents/unit-openstack-dashboard-0/charm/actions/security-checklist", line 185, in main
          stderr=sys.stderr)
        File "/usr/lib/python3.5/subprocess.py", line 626, in check_output
          **kwargs).stdout
        File "/usr/lib/python3.5/subprocess.py", line 708, in run
          output=stdout, stderr=stderr)
      subprocess.CalledProcessError: Command '['sudo', '-u', 'horizon', 'python3', 'actions/local_settings_to_json.py']' returned non-zero exit status 1
  status: failed
  timing:

Currently both python and python3 are supported in the test bundles (like xenail-mitaka), so this will have to be changed to pick the correct interpreter, depending on what's available.

Gleland commented 3 years ago

I added a charm-agnostic bug here as well, to track if this exists in other locations as well.

Gleland commented 3 years ago

I'm going to close this issue, as it doesn't make sense to track it in two places. Please follow bug 1915293 for updates.