diff options
author | Jenkins <jenkins@review.openstack.org> | 2012-11-07 05:41:57 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2012-11-07 05:41:57 +0000 |
commit | ee3d2a190844b7b0493545c6e6967cfdf520a67d (patch) | |
tree | 5ada6a336288e02f6d70495128cad7434e943976 /nova/notifications.py | |
parent | d4dd0842b63ff3bbe0f51f3e222c0d852df79f9c (diff) | |
parent | 637e805634b5179ffacad57ee26d4175449537f5 (diff) | |
download | nova-ee3d2a190844b7b0493545c6e6967cfdf520a67d.tar.gz nova-ee3d2a190844b7b0493545c6e6967cfdf520a67d.tar.xz nova-ee3d2a190844b7b0493545c6e6967cfdf520a67d.zip |
Merge "Switch from FLAGS to CONF in misc modules"
Diffstat (limited to 'nova/notifications.py')
-rw-r--r-- | nova/notifications.py | 23 |
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 |