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/compute/manager.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'nova/compute') 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) -- cgit