summaryrefslogtreecommitdiffstats
path: root/openstack/common/notifier/api.py
diff options
context:
space:
mode:
Diffstat (limited to 'openstack/common/notifier/api.py')
-rw-r--r--openstack/common/notifier/api.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/openstack/common/notifier/api.py b/openstack/common/notifier/api.py
index 7c4dbd1..dc4f578 100644
--- a/openstack/common/notifier/api.py
+++ b/openstack/common/notifier/api.py
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import socket
import uuid
from oslo.config import cfg
@@ -35,7 +36,7 @@ notifier_opts = [
default='INFO',
help='Default notification level for outgoing notifications'),
cfg.StrOpt('default_publisher_id',
- default='$host',
+ default=None,
help='Default publisher_id for outgoing notifications'),
]
@@ -74,7 +75,7 @@ def notify_decorator(name, fn):
ctxt = context.get_context_from_function_and_args(fn, args, kwarg)
notify(ctxt,
- CONF.default_publisher_id,
+ CONF.default_publisher_id or socket.gethostname(),
name,
CONF.default_notification_level,
body)
@@ -84,7 +85,10 @@ def notify_decorator(name, fn):
def publisher_id(service, host=None):
if not host:
- host = CONF.host
+ try:
+ host = CONF.host
+ except AttributeError:
+ host = CONF.default_publisher_id or socket.gethostname()
return "%s.%s" % (service, host)