blob: 008af2b2f78851c92487a5b4611b5d01909cf2bc [file] [log] [blame]
import base_section
from runtest import conditions
class Dashboard(base_section.BaseSection):
name = "dashboard"
options = [
'dashboard_url',
'login_url',
'disable_ssl_certificate_validation',
]
@property
def dashboard_url(self):
horizon_enable = conditions.BaseRule('horizon.server.enabled', 'eq', True,multiple='any')
if not horizon_enable:
return
nginx_enable = conditions.BaseRule('nginx.server.enabled', 'eq', True)
if self.get_item_when_condition_match('horizon.server.enabled', horizon_enable):
if self.get_item_when_condition_match('nginx.server.site.nginx_proxy_openstack_web.enabled', nginx_enable):
port = self.get_item_when_condition_match('nginx.server.site.nginx_proxy_openstack_web.host.port', nginx_enable)
protocol = self.get_item_when_condition_match('nginx.server.site.nginx_proxy_openstack_web.host.protocol', nginx_enable)
ip = self.get_item_when_condition_match('nginx.server.site.nginx_proxy_openstack_web.host.name', nginx_enable)
else:
port = self.get_item_when_condition_match('horizon.server.bind.port', horizon_enable)
protocol = 'http'
ip = self.get_item_when_condition_match('_param.cluster_local_address', horizon_enable)
return "{}://{}:{}".format(protocol, ip, port)
@property
def login_url(self):
if self.dashboard_url:
return "{}/auth/login/".format(self.dashboard_url)
@property
def disable_ssl_certificate_validation(self):
pass