Fixed some docstring

Added default publisher_id flagw
This commit is contained in:
Nachi Ueno 2011-08-23 09:46:49 -07:00
parent f380b65cdc
commit 76f02277a3
5 changed files with 16 additions and 20 deletions

View File

@ -25,6 +25,9 @@ FLAGS = flags.FLAGS
flags.DEFINE_string('default_notification_level', 'INFO',
'Default notification level for outgoing notifications')
flags.DEFINE_string('default_publisher_id', FLAGS.host,
'Default publisher_id for outgoing notifications')
WARN = 'WARN'
INFO = 'INFO'
@ -55,9 +58,9 @@ def notify_decorator(name, fn):
body['args'].append(arg)
for key in kwarg:
body['kwarg'][key] = kwarg[key]
notify(FLAGS.host,
notify(FLAGS.default_publisher_id,
name,
DEBUG,
FLAGS.default_notification_level,
body)
return fn(*args, **kwarg)
return wrapped_func

View File

@ -1,3 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
@ -12,8 +14,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Example Module for testing utils.monkey_patch()
"""
"""Example Module for testing utils.monkey_patch()."""
CALLED_FUNCTION = []
@ -21,12 +22,10 @@ CALLED_FUNCTION = []
def example_decorator(name, function):
""" decorator for notify which is used from utils.monkey_patch()
Parameters:
name - name of the function
function - object of the function
:param name: name of the function
:param function: - object of the function
:returns: function -- decorated function
"""
def wrapped_func(*args, **kwarg):
CALLED_FUNCTION.append(name)

View File

@ -1,7 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -15,9 +14,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Example Module A for testing utils.monkey_patch()
"""
"""Example Module A for testing utils.monkey_patch()."""
def example_function_a():

View File

@ -1,7 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -16,8 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
"""Example Module B for testing utils.monkey_patch()
"""
"""Example Module B for testing utils.monkey_patch()."""
def example_function_b():

View File

@ -141,8 +141,7 @@ class NotifierTestCase(test.TestCase):
def example_api(arg1, arg2):
return arg1 + arg2
example_api =\
nova.notifier.api.notify_decorator(
example_api = nova.notifier.api.notify_decorator(
'example_api',
example_api)