bad default value for [wsgi] /python_interpreter option

Bug #1962581 reported by Brian Rosmaita
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
Brian Rosmaita

Bug Description

Noticed when reviewing glance-api.conf in https://review.opendev.org/c/openstack/glance/+/831368

  # Path to the python interpreter to use when spawning external
  # processes. By default this is sys.executable, which should be the
  # same interpreter running Glance itself. However, in some situations
  # (i.e. uwsgi) this may not actually point to a python interpreter
  # itself. (string value)
  #python_interpreter = /home/ubuntu/glance/.tox/genconfig/bin/python

It's pretty unlikely that that's going to be correct in any actual deployment.

The option is used by us at:
https://opendev.org/openstack/glance/src/commit/b434adba615fd139f6d3c8bd173e5870d102ae83/glance/async_/flows/plugins/image_conversion.py#L72
(to set self.python)
and
https://opendev.org/openstack/glance/src/commit/b434adba615fd139f6d3c8bd173e5870d102ae83/glance/async_/flows/plugins/image_conversion.py#L95
(to pass self.python as the value of the 'python_exec' argument to putils)

processutils does this with it:
https://opendev.org/openstack/oslo.concurrency/src/commit/95b9334cfab6849fbe47e2b118e5355af3675dba/oslo_concurrency/processutils.py#L332

   python_exec = kwargs.pop('python_exec', sys.executable)

This is the point where sys.executable should be evaluated, not when the option help text is generated.

Thus, the default value glance sets for this option should be None, which corresponds to putils using sys.executable if the option isn't set.

Changed in glance:
assignee: nobody → Brian Rosmaita (brian-rosmaita)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/glance/+/831381

Changed in glance:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.opendev.org/c/openstack/glance/+/831381
Committed: https://opendev.org/openstack/glance/commit/daa602baa900530fbd0a49ad67e7e1b5e0ae9343
Submitter: "Zuul (22348)"
Branch: master

commit daa602baa900530fbd0a49ad67e7e1b5e0ae9343
Author: Brian Rosmaita <email address hidden>
Date: Tue Mar 1 09:13:09 2022 -0500

    Change default value for [wsgi]/python_interpreter

    The default value is being set too early. We don't want to use
    the value of sys.executable at the time the config is generated,
    because that's unlikely to map to an existing interpreter in an
    actual deployment.

    Change-Id: Ic40f582f83e04c6915a3fcb231d6d95ca071c100
    Closes-bug: #1962581

Changed in glance:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 24.0.0.0rc1

This issue was fixed in the openstack/glance 24.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to glance (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/glance/+/841135

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to glance (master)

Reviewed: https://review.opendev.org/c/openstack/glance/+/841135
Committed: https://opendev.org/openstack/glance/commit/6af8b6e51c78ca8cf8259a4a6d63e5a7b5220088
Submitter: "Zuul (22348)"
Branch: master

commit 6af8b6e51c78ca8cf8259a4a6d63e5a7b5220088
Author: Brian Rosmaita <email address hidden>
Date: Mon May 9 11:39:11 2022 -0400

    Remove workaround for python_exec cannot be None

    oslo.config 4.5.1 contains change I2e1f187feaf4, which makes
    the workaround introduced by change Ic40f582f83e0 unnecessary.

    Change-Id: Ib7fc2f2082981b1765e901ca5b277fce08221ba8
    Related-bug: #1962581
    Related-bug: #1962603

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.