summaryrefslogtreecommitdiffstats
path: root/nova/notifications.py
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2012-11-04 21:32:45 +0000
committerMark McLoughlin <markmc@redhat.com>2012-11-04 21:46:35 +0000
commit637e805634b5179ffacad57ee26d4175449537f5 (patch)
treec0ff2f32d3f2957ae7b96a2eedc35b0029917048 /nova/notifications.py
parent8ce58defbe560b1da34d991b38ac64a9b4c8d654 (diff)
downloadnova-637e805634b5179ffacad57ee26d4175449537f5.tar.gz
nova-637e805634b5179ffacad57ee26d4175449537f5.tar.xz
nova-637e805634b5179ffacad57ee26d4175449537f5.zip
Switch from FLAGS to CONF in misc modules
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: Ib110ba8d1837780e90b0d3fe13f8e6b68ed15f65
Diffstat (limited to 'nova/notifications.py')
-rw-r--r--nova/notifications.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/nova/notifications.py b/nova/notifications.py
index 2df5b95f7..7153933ee 100644
--- a/nova/notifications.py
+++ b/nova/notifications.py
@@ -19,6 +19,7 @@
the system.
"""
+from nova import config
import nova.context
from nova import db
from nova import exception
@@ -50,16 +51,16 @@ notify_api_faults = cfg.BoolOpt('notify_api_faults', default=False,
'in the API service.')
-FLAGS = flags.FLAGS
-FLAGS.register_opt(notify_state_opt)
-FLAGS.register_opt(notify_any_opt)
-FLAGS.register_opt(notify_api_faults)
+CONF = config.CONF
+CONF.register_opt(notify_state_opt)
+CONF.register_opt(notify_any_opt)
+CONF.register_opt(notify_api_faults)
def send_api_fault(url, status, exception):
"""Send an api.fault notification."""
- if not FLAGS.notify_api_faults:
+ if not CONF.notify_api_faults:
return
payload = {'url': url, 'exception': str(exception), 'status': status}
@@ -75,7 +76,7 @@ def send_update(context, old_instance, new_instance, service=None, host=None):
in that instance
"""
- if not FLAGS.notify_on_any_change and not FLAGS.notify_on_state_change:
+ if not CONF.notify_on_any_change and not CONF.notify_on_state_change:
# skip all this if updates are disabled
return
@@ -91,8 +92,8 @@ def send_update(context, old_instance, new_instance, service=None, host=None):
if old_vm_state != new_vm_state:
# yes, the vm state is changing:
update_with_state_change = True
- elif FLAGS.notify_on_state_change:
- if (FLAGS.notify_on_state_change.lower() == "vm_and_task_state" and
+ elif CONF.notify_on_state_change:
+ if (CONF.notify_on_state_change.lower() == "vm_and_task_state" and
old_task_state != new_task_state):
# yes, the task state is changing:
update_with_state_change = True
@@ -120,7 +121,7 @@ def send_update_with_states(context, instance, old_vm_state, new_vm_state,
are any, in the instance
"""
- if not FLAGS.notify_on_state_change:
+ if not CONF.notify_on_state_change:
# skip all this if updates are disabled
return
@@ -135,8 +136,8 @@ def send_update_with_states(context, instance, old_vm_state, new_vm_state,
if old_vm_state != new_vm_state:
# yes, the vm state is changing:
fire_update = True
- elif FLAGS.notify_on_state_change:
- if (FLAGS.notify_on_state_change.lower() == "vm_and_task_state" and
+ elif CONF.notify_on_state_change:
+ if (CONF.notify_on_state_change.lower() == "vm_and_task_state" and
old_task_state != new_task_state):
# yes, the task state is changing:
fire_update = True