From 32af3c94bd62c46713a44bf75f2e4989f8b98bc4 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Wed, 12 Dec 2012 07:14:12 +0000 Subject: Properly scope password options enable_instance_password is only used in api.openstack.compute.servers so move it there. password_length is passed as a parameter to every generate_password() call, so just move it into nova.utils and have generate_password() use it by default. Note: using a config option as the default value of a kwarg isn't a good idea because the option value is read when the function is defined which means you can't control its value during unit tests. Instead we use password=None as the default. blueprint: scope-config-opts Change-Id: I445174515fc2eacc56c7cccecadadd2a7e57d4f4 --- nova/tests/api/openstack/compute/contrib/test_rescue.py | 2 +- nova/tests/api/openstack/compute/contrib/test_volumes.py | 2 +- nova/tests/api/openstack/compute/test_server_actions.py | 2 +- nova/tests/api/openstack/compute/test_servers.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/api/openstack/compute/contrib/test_rescue.py b/nova/tests/api/openstack/compute/contrib/test_rescue.py index 0d735d5ec..2719c1339 100644 --- a/nova/tests/api/openstack/compute/contrib/test_rescue.py +++ b/nova/tests/api/openstack/compute/contrib/test_rescue.py @@ -22,7 +22,7 @@ from nova import test from nova.tests.api.openstack import fakes CONF = cfg.CONF -CONF.import_opt('password_length', 'nova.config') +CONF.import_opt('password_length', 'nova.utils') def rescue(self, context, instance, rescue_password=None): diff --git a/nova/tests/api/openstack/compute/contrib/test_volumes.py b/nova/tests/api/openstack/compute/contrib/test_volumes.py index 17ac244ff..21befe5e6 100644 --- a/nova/tests/api/openstack/compute/contrib/test_volumes.py +++ b/nova/tests/api/openstack/compute/contrib/test_volumes.py @@ -32,7 +32,7 @@ from nova.volume import cinder from webob import exc CONF = cfg.CONF -CONF.import_opt('password_length', 'nova.config') +CONF.import_opt('password_length', 'nova.utils') FAKE_UUID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' FAKE_UUID_A = '00000000-aaaa-aaaa-aaaa-000000000000' diff --git a/nova/tests/api/openstack/compute/test_server_actions.py b/nova/tests/api/openstack/compute/test_server_actions.py index dbb854c58..a0330d2cc 100644 --- a/nova/tests/api/openstack/compute/test_server_actions.py +++ b/nova/tests/api/openstack/compute/test_server_actions.py @@ -35,7 +35,7 @@ from nova.tests import matchers CONF = cfg.CONF -CONF.import_opt('password_length', 'nova.config') +CONF.import_opt('password_length', 'nova.utils') FAKE_UUID = fakes.FAKE_UUID INSTANCE_IDS = {FAKE_UUID: 1} diff --git a/nova/tests/api/openstack/compute/test_servers.py b/nova/tests/api/openstack/compute/test_servers.py index d8c388865..0afbecb22 100644 --- a/nova/tests/api/openstack/compute/test_servers.py +++ b/nova/tests/api/openstack/compute/test_servers.py @@ -54,7 +54,7 @@ from nova.tests import matchers CONF = cfg.CONF -CONF.import_opt('password_length', 'nova.config') +CONF.import_opt('password_length', 'nova.utils') CONF.import_opt('scheduler_topic', 'nova.config') FAKE_UUID = fakes.FAKE_UUID -- cgit