summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNachi Ueno <ueno.nachi@lab.ntt.co.jp>2011-08-23 09:46:49 -0700
committerNachi Ueno <ueno.nachi@lab.ntt.co.jp>2011-08-23 09:46:49 -0700
commit76f02277a3677d40a13a8b05a12f9d83053808c3 (patch)
tree51ce44bf3c7d8daa7cec3c50462330d6845a8ca2
parentf380b65cdce439d440b68b0f4a65be45d13ce453 (diff)
downloadnova-76f02277a3677d40a13a8b05a12f9d83053808c3.tar.gz
nova-76f02277a3677d40a13a8b05a12f9d83053808c3.tar.xz
nova-76f02277a3677d40a13a8b05a12f9d83053808c3.zip
Fixed some docstring
Added default publisher_id flagw
-rw-r--r--nova/notifier/api.py7
-rw-r--r--nova/tests/monkey_patch_example/__init__.py13
-rw-r--r--nova/tests/monkey_patch_example/example_a.py7
-rw-r--r--nova/tests/monkey_patch_example/example_b.py6
-rw-r--r--nova/tests/test_notifier.py3
5 files changed, 16 insertions, 20 deletions
diff --git a/nova/notifier/api.py b/nova/notifier/api.py
index f5cf95d2a..6ef4a050e 100644
--- a/nova/notifier/api.py
+++ b/nova/notifier/api.py
@@ -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
diff --git a/nova/tests/monkey_patch_example/__init__.py b/nova/tests/monkey_patch_example/__init__.py
index 1cfdf8a7e..25cf9ccfe 100644
--- a/nova/tests/monkey_patch_example/__init__.py
+++ b/nova/tests/monkey_patch_example/__init__.py
@@ -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)
diff --git a/nova/tests/monkey_patch_example/example_a.py b/nova/tests/monkey_patch_example/example_a.py
index 91bf048e4..21e79bcb0 100644
--- a/nova/tests/monkey_patch_example/example_a.py
+++ b/nova/tests/monkey_patch_example/example_a.py
@@ -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():
diff --git a/nova/tests/monkey_patch_example/example_b.py b/nova/tests/monkey_patch_example/example_b.py
index edd267c4f..9d8f6d339 100644
--- a/nova/tests/monkey_patch_example/example_b.py
+++ b/nova/tests/monkey_patch_example/example_b.py
@@ -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():
diff --git a/nova/tests/test_notifier.py b/nova/tests/test_notifier.py
index ab5dfb692..7de3a4a99 100644
--- a/nova/tests/test_notifier.py
+++ b/nova/tests/test_notifier.py
@@ -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)