Merge "Allow off-host access to horizon dashboard by default."
This commit is contained in:
commit
2f5847d6ad
|
@ -18,6 +18,7 @@ snapctl set \
|
||||||
config.network.compute-ip=10.20.20.1 \
|
config.network.compute-ip=10.20.20.1 \
|
||||||
config.network.ext-cidr=10.20.20.1/24 \
|
config.network.ext-cidr=10.20.20.1/24 \
|
||||||
config.network.security-rules=true \
|
config.network.security-rules=true \
|
||||||
|
config.network.dashboard-allowed-hosts="*" \
|
||||||
;
|
;
|
||||||
|
|
||||||
# Passwords, certs, etc.
|
# Passwords, certs, etc.
|
||||||
|
|
|
@ -117,23 +117,6 @@ class TestBasics(Framework):
|
||||||
# TODO: get rid of this, when we drop the ping tests back int.
|
# TODO: get rid of this, when we drop the ping tests back int.
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
if 'multipass' in self.PREFIX:
|
|
||||||
print("Opening {}:80 up to the outside world".format(
|
|
||||||
self.HORIZON_IP))
|
|
||||||
|
|
||||||
with open('/tmp/_10_hosts.py', 'w') as hosts:
|
|
||||||
hosts.write("""\
|
|
||||||
# Allow all hosts to connect to this machine
|
|
||||||
ALLOWED_HOSTS = ['*',]
|
|
||||||
""")
|
|
||||||
check('multipass', 'copy-files', '/tmp/_10_hosts.py',
|
|
||||||
'{}:/tmp/_10_hosts.py'.format(self.MACHINE))
|
|
||||||
check(
|
|
||||||
*self.PREFIX, 'sudo', 'cp', '/tmp/_10_hosts.py',
|
|
||||||
'/var/snap/microstack/common/etc/horizon/local_settings.d/'
|
|
||||||
)
|
|
||||||
check(*self.PREFIX, 'sudo', 'snap', 'restart', 'microstack')
|
|
||||||
|
|
||||||
print('Verifying GUI for (IP: {})'.format(self.HORIZON_IP))
|
print('Verifying GUI for (IP: {})'.format(self.HORIZON_IP))
|
||||||
# Verify that our GUI is working properly
|
# Verify that our GUI is working properly
|
||||||
self.driver.get("http://{}/".format(self.HORIZON_IP))
|
self.driver.get("http://{}/".format(self.HORIZON_IP))
|
||||||
|
|
|
@ -103,6 +103,7 @@ def main() -> None:
|
||||||
# The following are not yet implemented:
|
# The following are not yet implemented:
|
||||||
# questions.VmSwappiness(),
|
# questions.VmSwappiness(),
|
||||||
# questions.FileHandleLimits(),
|
# questions.FileHandleLimits(),
|
||||||
|
questions.DashboardAccess(),
|
||||||
questions.RabbitMq(),
|
questions.RabbitMq(),
|
||||||
questions.DatabaseSetup(),
|
questions.DatabaseSetup(),
|
||||||
questions.NovaHypervisor(),
|
questions.NovaHypervisor(),
|
||||||
|
|
|
@ -275,6 +275,32 @@ class FileHandleLimits(Question):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class DashboardAccess(Question):
|
||||||
|
|
||||||
|
_type = 'string'
|
||||||
|
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):
|
class RabbitMq(Question):
|
||||||
"""Wait for Rabbit to start, then setup permissions."""
|
"""Wait for Rabbit to start, then setup permissions."""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue