c521b8c28c
use absolute path imports to compat python3 remove H301 ignore to enable H304 flake8 check Story: 2003433 Task: 28376 Change-Id: I3a50a0298fe34c60e3c63df23e72dcbb07c585d1 Signed-off-by: Sun Austin <austin.sun@intel.com>
58 lines
1.5 KiB
Python
58 lines
1.5 KiB
Python
#
|
|
# Copyright (c) 2017 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
from sysinv.puppet import openstack
|
|
|
|
from sysinv.common import exception
|
|
|
|
|
|
class HorizonPuppet(openstack.OpenstackBasePuppet):
|
|
"""Class to encapsulate puppet operations for horizon configuration"""
|
|
|
|
def get_secure_static_config(self):
|
|
return {
|
|
'openstack::horizon::params::secret_key':
|
|
self._generate_random_password(length=32),
|
|
}
|
|
|
|
def get_system_config(self):
|
|
config = {
|
|
'openstack::horizon::params::enable_https':
|
|
self._https_enabled(),
|
|
'openstack::horizon::params::openstack_host':
|
|
self._keystone_auth_host(),
|
|
|
|
}
|
|
tpm_config = self._get_tpm_config()
|
|
if tpm_config is not None:
|
|
config.update(tpm_config)
|
|
return config
|
|
|
|
def _get_tpm_config(self):
|
|
try:
|
|
tpmconfig = self.dbapi.tpmconfig_get_one()
|
|
if tpmconfig.tpm_path:
|
|
return {
|
|
'openstack::horizon::params::tpm_object':
|
|
tpmconfig.tpm_path
|
|
}
|
|
except exception.NotFound:
|
|
pass
|
|
|
|
return None
|
|
|
|
def get_public_url(self):
|
|
# not an openstack service
|
|
raise NotImplementedError()
|
|
|
|
def get_internal_url(self):
|
|
# not an openstack service
|
|
raise NotImplementedError()
|
|
|
|
def get_admin_url(self):
|
|
# not an openstack service
|
|
raise NotImplementedError()
|