hide-create-volume config added

The configuration option hide-create-volume was added and is passed into the horizon configuration as hide_create_volume.

Closes-Bug: #1939079
Change-Id: I639810d5908cc58f41907f9a3bd66dc78b9517d6
(cherry picked from commit 18a9ac1171)
This commit is contained in:
Bartlomiej Poniecki-Klotz 2021-10-26 12:57:52 +02:00 committed by Felipe Reyes
parent e65a3704af
commit 431bd19dca
4 changed files with 1103 additions and 0 deletions

View File

@ -340,6 +340,12 @@ options:
workflow for image and instance snapshot sources when launching an
instance. This option has an effect only to Ocata or newer
releases.
hide-create-volume:
type: boolean
default: False
description: |
Hide the "Create New Volume" option and rely on the
default-create-volume value during instance creation.
image-formats:
type: string
default: ""

View File

@ -245,6 +245,7 @@ class HorizonContext(OSContextGenerator):
'default_domain': config('default-domain'),
'multi_domain': False if config('default-domain') else True,
"default_create_volume": config("default-create-volume"),
'hide_create_volume': config('hide-create-volume'),
'image_formats': config('image-formats'),
'api_result_limit': config('api-result-limit') or 1000,
'enable_fip_topology_check': config('enable-fip-topology-check'),

File diff suppressed because it is too large Load Diff

View File

@ -116,6 +116,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -150,6 +151,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": False,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -185,6 +187,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -220,6 +223,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -254,6 +258,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -288,6 +293,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -323,6 +329,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -361,6 +368,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -395,6 +403,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
"hide_create_volume": False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -434,6 +443,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -468,6 +478,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -502,6 +513,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -537,6 +549,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": True,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -572,6 +585,43 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": False,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
"session_timeout": 3600,
"dropdown_max_items": 30,
"enable_consistency_groups": False,
"disable_instance_snapshot": False,
"disable_password_reveal": False,
"enforce_password_check": True,
}
)
def test_HorizonContext_hide_create_volume(self):
self.maxDiff = 900
self.test_config.set('hide-create-volume', True)
self.assertEqual(horizon_contexts.HorizonContext()(),
{'compress_offline': True, 'debug': False,
'customization_module': '',
'webroot': '/horizon',
'ubuntu_theme': True,
'default_theme': None,
'custom_theme': False,
'secret': 'secret',
'support_profile': None,
"neutron_network_dvr": False,
"neutron_network_l3ha": False,
"neutron_network_lb": False,
"neutron_network_firewall": False,
"neutron_network_vpn": False,
"cinder_backup": False,
"password_retrieve": False,
"default_domain": None,
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': True,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -607,6 +657,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": 'iso qcow2 raw',
"api_result_limit": 1000,
"enable_fip_topology_check": True,
@ -642,6 +693,7 @@ class TestHorizonContexts(CharmTestCase):
"multi_domain": True,
"allow_password_autocompletion": False,
"default_create_volume": True,
'hide_create_volume': False,
"image_formats": '',
"api_result_limit": 1000,
"enable_fip_topology_check": False,