Add support for configuring password retrieve function

The OpenStack Dashboard has supported retrieving the instance
password from Nova since Icehouse. This feature is disabled by
default. Allow user to enable it.

Change-Id: Iaeeac46f56c36bc7620471c52fd0e56b1e9f1512
Closes-Bug: 1651893
This commit is contained in:
Frode Nordahl 2016-12-23 09:18:42 +01:00
parent 1e3fe19243
commit 8f3a93ac4e
8 changed files with 73 additions and 8 deletions

View File

@ -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

View File

@ -193,6 +193,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,
}

View File

@ -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') }}

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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_compression(self):
self.test_config.set('offline-compression', 'no')
@ -182,7 +194,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')
@ -199,7 +214,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', '/')
@ -216,7 +234,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)
@ -238,7 +259,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 = []