summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2012-12-12 07:14:12 +0000
committerMark McLoughlin <markmc@redhat.com>2012-12-12 08:26:59 +0000
commit32af3c94bd62c46713a44bf75f2e4989f8b98bc4 (patch)
tree6855a1fe7940cc706f07f90c36c5f7e32f356f83 /nova/compute
parentac658aa7d0671fb9b5a0a2c504f4b73dff514da9 (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/compute')
-rw-r--r--nova/compute/manager.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index e5b97c0ed..d566537eb 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -175,7 +175,6 @@ CONF.import_opt('console_topic', 'nova.config')
CONF.import_opt('host', 'nova.config')
CONF.import_opt('my_ip', 'nova.config')
CONF.import_opt('network_manager', 'nova.config')
-CONF.import_opt('password_length', 'nova.config')
CONF.import_opt('reclaim_instance_interval', 'nova.config')
CONF.import_opt('vpn_image_id', 'nova.config')
CONF.import_opt('my_ip', 'nova.config')
@@ -1464,7 +1463,7 @@ class ComputeManager(manager.SchedulerDependentManager):
if new_pass is None:
# Generate a random password
- new_pass = utils.generate_password(CONF.password_length)
+ new_pass = utils.generate_password()
max_tries = 10
@@ -1574,7 +1573,7 @@ class ComputeManager(manager.SchedulerDependentManager):
LOG.audit(_('Rescuing'), context=context, instance=instance)
admin_password = (rescue_password if rescue_password else
- utils.generate_password(CONF.password_length))
+ utils.generate_password())
network_info = self._get_instance_nw_info(context, instance)