Switch from FLAGS to CONF in nova.api

Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.

We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.

Change-Id: I11fda86471fbf02eec342b95ec314792388307e3
This commit is contained in:
Mark McLoughlin
2012-11-04 21:32:46 +00:00
parent 8ce58defbe
commit 33496c15ec
36 changed files with 98 additions and 123 deletions

View File

@@ -21,6 +21,7 @@ from nova.cloudpipe import pipelib
from nova import compute
from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova import config
from nova import db
from nova import exception
from nova import flags
@@ -30,8 +31,7 @@ from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import utils
FLAGS = flags.FLAGS
CONF = config.CONF
LOG = logging.getLogger(__name__)
authorize = extensions.extension_authorizer('compute', 'cloudpipe')
@@ -70,12 +70,12 @@ class CloudpipeController(object):
# NOTE(vish): One of the drawbacks of doing this in the api is
# the keys will only be on the api node that launched
# the cloudpipe.
fileutils.ensure_tree(FLAGS.keys_path)
fileutils.ensure_tree(CONF.keys_path)
def _get_all_cloudpipes(self, context):
"""Get all cloudpipes"""
return [instance for instance in self.compute_api.get_all(context)
if instance['image_ref'] == str(FLAGS.vpn_image_id)
if instance['image_ref'] == str(CONF.vpn_image_id)
and instance['vm_state'] != vm_states.DELETED]
def _get_cloudpipe_for_project(self, context, project_id):