Comment 10 for bug 2064503

Revision history for this message
Myles Penner (mylesjp) wrote :

@freyes and I had a look at this bug and believe the issue stems from ApacheSSLContext defined in cinder_contexts.py[0] never fetching the provided port value in the api-listening-port config option:

The template that renders cinder-wsgi.conf uses 'ext_ports' as the external port[1]
ApacheSSLContext in charm-helpers provides the template that 'ext_ports' value[2]
ApacheSSLContext in cinder_contexts.py defines hard codes external_port as 8776[3]

It doesn't appear that the user-provided port value in 'api-listening-port' gets fetched at all.

A possible solution could be as follows:

# charm-cinder/.../hooks/cinder_context.py

class ApacheSSLContext(SSLContext):
    interfaces = ['https']
    external_ports = [8776]
    service_namespace = 'cinder'

    def __call__(self):
        # late import to work around circular dependency
        from cinder_utils import service_enabled
        if not service_enabled('api'):
            return {}
        # fetch the user-provided port if provided and use it as 'external_ports'
        if config('api-listening-port') > 0 and config('api-listening-port') < 65536:
            self.external_ports = [config('api-listening-port')]
        return super(ApacheSSLContext, self).__call__()

[0] https://opendev.org/openstack/charm-cinder/src/branch/master/hooks/cinder_contexts.py#L128
[1] https://github.com/juju/charm-helpers/blob/master/charmhelpers/contrib/openstack/templates/openstack_https_frontend#L6
[2] https://github.com/juju/charm-helpers/blob/master/charmhelpers/contrib/openstack/context.py#L1258
[3] https://opendev.org/openstack/charm-cinder/src/branch/master/hooks/cinder_contexts.py#L130