diff options
| author | Mark McLoughlin <markmc@redhat.com> | 2012-12-12 07:14:12 +0000 |
|---|---|---|
| committer | Mark McLoughlin <markmc@redhat.com> | 2012-12-12 08:26:59 +0000 |
| commit | 32af3c94bd62c46713a44bf75f2e4989f8b98bc4 (patch) | |
| tree | 6855a1fe7940cc706f07f90c36c5f7e32f356f83 /nova/tests | |
| parent | ac658aa7d0671fb9b5a0a2c504f4b73dff514da9 (diff) | |
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
Diffstat (limited to 'nova/tests')
4 files changed, 4 insertions, 4 deletions
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 |
