diff --git a/config.yaml b/config.yaml index 473752f6..1d595f03 100644 --- a/config.yaml +++ b/config.yaml @@ -215,6 +215,10 @@ options: type: boolean default: False description: Enable cinder backup panel. + password-retrieve: + type: boolean + default: False + description: Enable "Retrieve password" instance action. prefer-ipv6: type: boolean default: False diff --git a/hooks/horizon_contexts.py b/hooks/horizon_contexts.py index 15733829..ea8bba50 100644 --- a/hooks/horizon_contexts.py +++ b/hooks/horizon_contexts.py @@ -195,6 +195,7 @@ class HorizonContext(OSContextGenerator): "neutron_network_firewall": config("neutron-network-firewall"), "neutron_network_vpn": config("neutron-network-vpn"), "cinder_backup": config("cinder-backup"), + "password_retrieve": config("password-retrieve"), 'virtualenv': git_pip_venv_dir(projects_yaml) if config('openstack-origin-git') else None, } diff --git a/templates/icehouse/local_settings.py b/templates/icehouse/local_settings.py index deaccf24..f45295ea 100644 --- a/templates/icehouse/local_settings.py +++ b/templates/icehouse/local_settings.py @@ -521,4 +521,8 @@ COMPRESS_OFFLINE = {{ compress_offline }} # see https://docs.djangoproject.com/en/dev/ref/settings/. ALLOWED_HOSTS = '*' +{% if password_retrieve %} +OPENSTACK_ENABLE_PASSWORD_RETRIEVE = True +{% endif %} + {{ settings|join('\n\n') }} diff --git a/templates/juno/local_settings.py b/templates/juno/local_settings.py index 09a44626..7cc10835 100644 --- a/templates/juno/local_settings.py +++ b/templates/juno/local_settings.py @@ -168,6 +168,9 @@ OPENSTACK_KEYSTONE_BACKEND = { #Setting this to True, will add a new "Retrieve Password" action on instance, #allowing Admin session password retrieval/decryption. #OPENSTACK_ENABLE_PASSWORD_RETRIEVE = False +{% if password_retrieve %} +OPENSTACK_ENABLE_PASSWORD_RETRIEVE = True +{% endif %} # The Xen Hypervisor has the ability to set the mount point for volumes # attached to instances (other Hypervisors currently do not). Setting diff --git a/templates/liberty/local_settings.py b/templates/liberty/local_settings.py index d470c693..98db0b36 100644 --- a/templates/liberty/local_settings.py +++ b/templates/liberty/local_settings.py @@ -191,6 +191,9 @@ OPENSTACK_KEYSTONE_BACKEND = { # Setting this to True, will add a new "Retrieve Password" action on instance, # allowing Admin session password retrieval/decryption. #OPENSTACK_ENABLE_PASSWORD_RETRIEVE = False +{% if password_retrieve %} +OPENSTACK_ENABLE_PASSWORD_RETRIEVE = True +{% endif %} # The Launch Instance user experience has been significantly enhanced. # You can choose whether to enable the new launch instance experience, diff --git a/templates/mitaka/local_settings.py b/templates/mitaka/local_settings.py index 45706851..04c2497f 100644 --- a/templates/mitaka/local_settings.py +++ b/templates/mitaka/local_settings.py @@ -256,6 +256,9 @@ OPENSTACK_KEYSTONE_BACKEND = { # Setting this to True, will add a new "Retrieve Password" action on instance, # allowing Admin session password retrieval/decryption. #OPENSTACK_ENABLE_PASSWORD_RETRIEVE = False +{% if password_retrieve %} +OPENSTACK_ENABLE_PASSWORD_RETRIEVE = True +{% endif %} # The Launch Instance user experience has been significantly enhanced. # You can choose whether to enable the new launch instance experience, diff --git a/templates/newton/local_settings.py b/templates/newton/local_settings.py index ba806194..cd44f39d 100644 --- a/templates/newton/local_settings.py +++ b/templates/newton/local_settings.py @@ -258,6 +258,9 @@ OPENSTACK_KEYSTONE_BACKEND = { # Setting this to True, will add a new "Retrieve Password" action on instance, # allowing Admin session password retrieval/decryption. #OPENSTACK_ENABLE_PASSWORD_RETRIEVE = False +{% if password_retrieve %} +OPENSTACK_ENABLE_PASSWORD_RETRIEVE = True +{% endif %} # The Launch Instance user experience has been significantly enhanced. # You can choose whether to enable the new launch instance experience, diff --git a/unit_tests/test_horizon_contexts.py b/unit_tests/test_horizon_contexts.py index bc963250..887e7df8 100644 --- a/unit_tests/test_horizon_contexts.py +++ b/unit_tests/test_horizon_contexts.py @@ -113,7 +113,10 @@ class TestHorizonContexts(CharmTestCase): "neutron_network_lb": False, "neutron_network_firewall": False, "neutron_network_vpn": False, - "cinder_backup": False}) + "cinder_backup": False, + "password_retrieve": False, + } + ) def test_HorizonContext_debug(self): self.test_config.set('debug', 'yes') @@ -130,7 +133,10 @@ class TestHorizonContexts(CharmTestCase): "neutron_network_lb": False, "neutron_network_firewall": False, "neutron_network_vpn": False, - "cinder_backup": False}) + "cinder_backup": False, + "password_retrieve": False, + } + ) def test_HorizonContext_ubuntu_theme(self): self.test_config.set('ubuntu-theme', 'False') @@ -147,7 +153,10 @@ class TestHorizonContexts(CharmTestCase): "neutron_network_lb": False, "neutron_network_firewall": False, "neutron_network_vpn": False, - "cinder_backup": False}) + "cinder_backup": False, + "password_retrieve": False, + } + ) def test_HorizonContext_default_theme(self): self.test_config.set('ubuntu-theme', 'False') @@ -165,7 +174,10 @@ class TestHorizonContexts(CharmTestCase): "neutron_network_lb": False, "neutron_network_firewall": False, "neutron_network_vpn": False, - "cinder_backup": False}) + "cinder_backup": False, + "password_retrieve": False, + } + ) def test_HorizonContext_default_theme_true(self): self.test_config.set('ubuntu-theme', 'true') @@ -186,7 +198,10 @@ class TestHorizonContexts(CharmTestCase): "neutron_network_lb": False, "neutron_network_firewall": False, "neutron_network_vpn": False, - "cinder_backup": False}) + "cinder_backup": False, + "password_retrieve": False, + } + ) def test_HorizonContext_role(self): self.test_config.set('default-role', 'foo') @@ -203,7 +218,10 @@ class TestHorizonContexts(CharmTestCase): "neutron_network_lb": False, "neutron_network_firewall": False, "neutron_network_vpn": False, - "cinder_backup": False}) + "cinder_backup": False, + "password_retrieve": False, + } + ) def test_HorizonContext_webroot(self): self.test_config.set('webroot', '/') @@ -220,7 +238,10 @@ class TestHorizonContexts(CharmTestCase): "neutron_network_lb": False, "neutron_network_firewall": False, "neutron_network_vpn": False, - "cinder_backup": False}) + "cinder_backup": False, + "password_retrieve": False, + } + ) def test_HorizonContext_panels(self): self.test_config.set('neutron-network-dvr', True) @@ -242,7 +263,30 @@ class TestHorizonContexts(CharmTestCase): "neutron_network_lb": True, "neutron_network_firewall": True, "neutron_network_vpn": True, - "cinder_backup": True}) + "cinder_backup": True, + "password_retrieve": False, + } + ) + + def test_HorizonContext_password_retrieve(self): + self.test_config.set('password-retrieve', True) + self.assertEquals(horizon_contexts.HorizonContext()(), + {'compress_offline': True, 'debug': False, + 'default_role': 'Member', 'webroot': '/horizon', + 'ubuntu_theme': True, + 'default_theme': None, + 'virtualenv': None, + '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": True, + } + ) def test_IdentityServiceContext_not_related(self): self.relation_ids.return_value = []