Skip to content

Commit

Permalink
Set can_set_mount_point default to False
Browse files Browse the repository at this point in the history
Patch https://review.openstack.org/#/c/59229/ only changed the default
value in the local_settings.py example file. If the setting isn't defined,
it still defaults to True

Change-Id: Ia3525786e5eb9ec83b8057c1cb6158ab153adc59
Closes-Bug: #1255136
  • Loading branch information
niuzhenguo committed Dec 4, 2013
1 parent efc88d4 commit 1b13a42
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion openstack_dashboard/dashboards/project/volumes/forms.py
Expand Up @@ -291,7 +291,7 @@ def __init__(self, *args, **kwargs):
"OPENSTACK_HYPERVISOR_FEATURES",
{})
can_set_mount_point = hypervisor_features.get("can_set_mount_point",
True)
False)
if not can_set_mount_point:
self.fields['device'].widget = forms.widgets.HiddenInput()
self.fields['device'].required = False
Expand Down
7 changes: 4 additions & 3 deletions openstack_dashboard/dashboards/project/volumes/tests.py
Expand Up @@ -679,6 +679,9 @@ def test_delete_volume_error_existing_snapshot(self):

@test.create_stubs({cinder: ('volume_get',), api.nova: ('server_list',)})
def test_edit_attachments(self):
PREV = settings.OPENSTACK_HYPERVISOR_FEATURES['can_set_mount_point']
settings.OPENSTACK_HYPERVISOR_FEATURES['can_set_mount_point'] = True

volume = self.volumes.first()
servers = [s for s in self.servers.list()
if s.tenant_id == self.request.user.tenant_id]
Expand All @@ -697,11 +700,10 @@ def test_edit_attachments(self):
self.assertEqual(res.status_code, 200)
self.assertTrue(isinstance(form.fields['device'].widget,
widgets.TextInput))
settings.OPENSTACK_HYPERVISOR_FEATURES['can_set_mount_point'] = PREV

@test.create_stubs({cinder: ('volume_get',), api.nova: ('server_list',)})
def test_edit_attachments_cannot_set_mount_point(self):
PREV = settings.OPENSTACK_HYPERVISOR_FEATURES['can_set_mount_point']
settings.OPENSTACK_HYPERVISOR_FEATURES['can_set_mount_point'] = False

volume = self.volumes.first()
servers = [s for s in self.servers.list()
Expand All @@ -717,7 +719,6 @@ def test_edit_attachments_cannot_set_mount_point(self):
form = res.context['form']
self.assertTrue(isinstance(form.fields['device'].widget,
widgets.HiddenInput))
settings.OPENSTACK_HYPERVISOR_FEATURES['can_set_mount_point'] = PREV

@test.create_stubs({cinder: ('volume_get',),
api.nova: ('server_get', 'server_list',),
Expand Down
2 changes: 1 addition & 1 deletion openstack_dashboard/test/settings.py
Expand Up @@ -115,7 +115,7 @@
}

OPENSTACK_HYPERVISOR_FEATURES = {
'can_set_mount_point': True,
'can_set_mount_point': False,
'can_set_password': True,
}

Expand Down

0 comments on commit 1b13a42

Please sign in to comment.