Browse Source

Fixed dashboard_allowed_hosts config setting.

Now happens in a template, just like all the other values, which fixes
an issue where it doesn't get overridden during an upgrade.

Change-Id: Ied84ddc0282c77de6797f90efc8923ae66a9d59e
changes/26/695226/2
Pete Vander Giessen 3 years ago committed by Frode Nordahl
parent
commit
2915caf98e
  1. 1
      snap-overlay/snap-openstack.yaml
  2. 2
      snap-overlay/templates/05_snap_tweaks.j2
  3. 19
      tools/init/init/questions/__init__.py

1
snap-overlay/snap-openstack.yaml

@ -68,6 +68,7 @@ setup:
extgateway: 'config.network.ext-gateway'
extcidr: 'config.network.ext-cidr'
dns: 'config.network.dns'
dashboard_allowed_hosts: 'config.network.dashboard-allowed-hosts'
entry_points:
keystone-manage:
binary: "{snap}/bin/keystone-manage"

2
snap-overlay/templates/05_snap_tweaks.j2

@ -28,7 +28,7 @@ OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_"
# Turn off external access for now. (This should be turned on once we
# have hooks for setting a non default password.)
ALLOWED_HOSTS = ['10.20.20.1', 'localhost', '127.0.0.1']
ALLOWED_HOSTS = "{{ dashboard_allowed_hosts }}".split(",")
# Use memcached as our caching backend.
CACHES = {

19
tools/init/init/questions/__init__.py

@ -249,31 +249,16 @@ class FileHandleLimits(Question):
pass
class DashboardAccess(Question):
class DashboardAccess(ConfigQuestion):
_type = 'string'
_question = 'Dashboard allowed hosts.'
config_key = 'config.network.dashboard-allowed-hosts'
def yes(self, answer):
log.info("Opening horizon dashboard up to {hosts}".format(
hosts=answer))
path_ = ('{SNAP_COMMON}/etc/horizon/local_settings.d'
'/_10_hosts.py'.format(**_env))
allowed_hosts = answer.split(',')
# TODO: move to template.
# TODO: sanitize (since we're writing to executable Python!)
with open(path_, 'w') as hosts:
hosts.write("""\
ALLOWED_HOSTS = {hosts}
""".format(hosts=allowed_hosts))
# Restart if needed.
if check_output('snapctl', 'get', 'initialized'):
check('snapctl', 'restart', 'microstack.horizon-uwsgi')
class RabbitMq(Question):
"""Wait for Rabbit to start, then setup permissions."""

Loading…
Cancel
Save