Commit Graph

29 Commits

Author SHA1 Message Date
Jay Faulkner 800c58826e Utilize the new RequestContext redacted_copy method
We now expect context objects to support returning a redacted copy of
themselves.

As a related cleanup, removed the practice entirely of using
dictionaries to represent contexts in unit tests and the logging driver.

As part of developing this change, I discovered code in Glance (and
potentially other services) which explicitly pass {} in lieu of a
context when notifying; so we now properly handle dictionaries as
contexts.

To ensure we have the method required; require oslo.context 5.3.0 or
newer.

Change-Id: I894f38cc83c98d3e8d48b59864c0c7c2d27e7dcd
2024-01-16 12:08:20 -08:00
Jay Faulkner c1b606f77e Add is_admin to safe fields list for notifications
We encountered bug 2037312 in unit tests when attempting to get this
change rolled out. Heat apparently will attempt to set is_admin using
policy logic if it's not passed in for a new context; this breaks as the
context we are requested doesn't have all the needed information to
exercise the policy logic.

is_admin is just a bool; it's not sensitive; easiest route forward is to
add it to the safe list

Closes-bug: 2037312
Change-Id: I78b08edfcb8115cddd7de9c6c788c0a57c8218a8
2023-09-25 17:51:32 +00:00
Jay Faulkner 1b315615e7 Only allow safe context fields in notifications
Publishing a fully hydrated context object in a notification would give
someone with access to that notification the ability to impersonate the
original actor through inclusion of sensitive fields.

Now, instead, we pare down the context object to the bare minimum before
passing it for serialization in notification workflows.

Related-bug: 2030976
Change-Id: Ic94323658c89df1c1ff32f511ca23502317d0f00
2023-08-11 13:07:54 -07:00
Andreas Jaeger e44c988306 Remove six usage
Remove six, the python 2/3 compatibility library. It's not needed
anymore since the repo is python3 only.

Remove a now unneeded hacking test.

Change-Id: I40522c4accb4aaf8115d11fee8b081e2d991cb4d
2020-05-11 10:21:58 +02:00
Hervé Beraud 1a860467bd Add help msg to payload for CLI notifier
Change-Id: I3d712ecfcea00ece0180108c585c858795fd2bce
2019-05-23 18:52:19 +02:00
Hervé Beraud 4f385720d7 Remove log translation and i18n
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

Change-Id: I9ddb6595fc52e46ed8844e39d2fa71029c90b65c
Closes-Bug: #1674567
2019-04-24 11:55:38 +02:00
Steve Kowalik e55f419017 Remove transport aliases support
To facilitate removing rpc_backend support, disentangle the aliases
code by removing it to simplify the code and the tests. Aliases were
first depreacted in 5.20.0 during Pike.

Change-Id: I7d80cd050ce1eca2c6b6c38f0fac29d090b90bf3
Closes-Bug: #1424728
2018-07-05 15:58:05 +10:00
Rajath Agasthya 03b6f18f80 Warn when wrong transport instance is used
Since RPC and notifications can have different backends, it is
useful to warn users if they use a notification transport in RPC
and vice versa. This patch introduces RPCTransport and
NotificationTransport subclasses of Transport, so it's easier to
add different behavior for them if need be.

Related-Bug: #1680192
Change-Id: Iab60544d69053c8e74c28a2d5c84665be749013f
2017-09-11 07:07:30 -07:00
Kenneth Giusti c7d880c33a Clean up the TransportURL documentation
Be specific regarding which characters can be used in the 'username'
and 'password' fields of the URL.

Change-Id: I9a2a801b3dd86fceffb05f4d52c715748c88d0cb
Closes-Bug: #1693967
2017-06-01 15:43:03 -04:00
Andrew Smith ec4d6639bc Add get_rpc_transport call
The get_rpc_transport wraps get_transport to unify the API in
anticipation of comprehensive separation of RPC and Notification
messaging backends.

Related-Bug: 1680192
Change-Id: Ic6af07b98ff43806c2af38a3ba129991f1e0ec86
2017-05-12 12:30:41 -04:00
Elancheran Subramanian cc406e4edc Retry support for oslo_messaging_notifications driver
When the underlying RPC is configured with rabbit along
with oslo_messaging_notifications, currently the retry is
not supported. There are retry support specific to drivers,
it's better to have the support uniform across the drivers,
by adding configuration retry on the oslo_messaging_notifier.

Closes-bug: 1666364

Change-Id: I8d547ef2a9e8b086f94a1efca17735f3f3cdaac1
2017-04-18 11:53:19 -07:00
Balazs Gibizer ed149bae81 Allow checking if notifier is enabled
Generating the payload of a notificatiton might be expensive due
to database access. This expensive step is unnecessary if the
notification driver is set to noop because it means that the
generated payload will not be sent.

This patch makes it possible for the user of the notifier to check
if the notifier will emit any notification before the payload
is generated.

Cinder already implemented similar behavior in
I77f655d3ef90088ce71304da5d4ea7b543991e90 and nova also plans
to do it in I3e6741d59df49e1e58409314008c2ed609fdedc1

Change-Id: Ib992f5c20fef85224fb00823e1d8d9c6cff19bec
2017-03-03 17:47:52 +01:00
gord chung 94c818dc98 drop topic keyword from Notifier
we marked it for removal >=5.0.0

Change-Id: I4634c082c2383569c4aa8a6d9a8a560de7e3c12f
2017-02-27 14:13:11 +00:00
Kenneth Giusti 9bc9c0dc6a Fixups to the inline documentation
Rework the inline documentation for executors, RPC servers and
clients, notifiers and notification listeners for clarity and flow.

Change-Id: If4f1db853a7fc85340177fd2c9c43a479d72459d
2016-09-12 09:49:00 -04:00
George Silvis, III a011cb2448 Add docstring for get_notification_transport
This was previously undocumented.  Most of the information was taken from the
docstring for get_transport

Change-Id: I92652f4de9dd1e59ae5c3f9ce39e5ee808f24c7d
2016-08-15 11:51:47 -04:00
Julien Danjou ff9b4bb938 notify: add a CLI tool to manually send notifications
Change-Id: I01ebd8402e322c5c27dc2fc4c61fb5beb2dddae8
2016-07-13 17:30:56 +02:00
liusheng e57afac051 [Trival] fix a typo nit
Change-Id: I3d40726cf55aedb838ebe605f3d58618d594acca
2016-06-13 16:34:12 +08:00
Juan Antonio Osorio Robles cbaf71edfa Make transport_url config option secret
The transport_url may contain credentials to the message queue; For
this reason, this option should be secret for it to not leak into the
logs.

Closes-Bug: #1567233

Change-Id: I49c641a2662976d7220e4222e3c4a4d2586b1336
2016-04-07 05:43:18 +00:00
Davanum Srinivas 2d53db6c51 Allow Notifier to have multiple topics
Looks like there is a disconnect between the __init__
parameter 'topic' in Notifier and what we need when
we look up a driver. We should allow multiple topics
to be specified as a new topics parameter and pass
that along directly.

Change-Id: Id89957411aa219cff92fafec2f448c81cb57b3ca
2016-02-25 06:43:00 +00:00
ChangBo Guo(gcb) 6b20fa8597 Improvement of logging acorrding to oslo.i18n guideline
1. Use translation marker functions, their argument must just be a string
2. Any message with more than one variable should use named
   interpolation instead of positional to allow translators
   to move the variables around in the string to account for
   differences in grammar and writing direction.
3. String interpolation should be delayed to be handled by the logging
   code, rather than being done at the point of the logging call.
For more details, please refert to oslo.i18n guideline [1]

Note: this commit doesn't touch test code.

[1] http://docs.openstack.org/developer/oslo.i18n/guidelines.html

Change-Id: I5f013d65b20396bbe0e5a2cceaed2a33fad1af23
2016-01-07 13:26:55 +08:00
Mehdi Abaakouk 050024f798 Fix notifier options registration
Change-Id: I37082f6f349e89af6b74e6ec5e5c416902299263
2015-12-08 16:01:49 +01:00
Davanum Srinivas 33c1010c32 Option group for notifications
In change Ief6f95ea906bfd95b3218a930c9db5d8a764beb9, we 
decoupled RPC and Notifications a bit. We should take another
step and separate out the options for notifications into 
its own group.

Change-Id: Ib51e2839f9035d0cc0e3f459939d9f9003a8c810
2015-11-30 19:30:05 +00:00
Davanum Srinivas 6621b9010e Decouple transport for RPC and Notification
Add a new configuration option for setting up
an alternate notification_transport_url that
can be used for notifications. This allows
operators to separate the transport mechanisms
used for RPC and Notifications.

DocImpact

Closes-Bug: #1504622
Change-Id: Ief6f95ea906bfd95b3218a930c9db5d8a764beb9
2015-11-10 20:40:22 -05:00
Davanum Srinivas 1893c495f6 Allow custom notification drivers
Our class hierarchy hides classes and modules that so its hard
for folks to write a custom Notification driver. We should
make these public and document them

Closes-Bug: #1426046
Change-Id: Ifb96c2ae9868426cac2700bf4917c27c02c90b15
2015-09-25 10:07:05 -04:00
Brant Knudson 60624a62a4 Fix missing space in help text
The help text for the notification_driver option was missing a
space.

Change-Id: I7ccad49c308b04d8fd8e45cb2b0b937f2ca8b189
2015-04-29 09:47:02 -05:00
Davanum Srinivas d214770b2b Document notification_driver possible values
Add list of drivers to help and FAQ.

Closes-Bug: #1440480
Change-Id: Ia0ea4693f88aa7550e55e7fb63111065ad9b6c3b
2015-04-06 10:12:08 -04:00
Doug Hellmann ee31a84719 Update Oslo imports to remove namespace package
Change-Id: I4ec9b2a310471e4e07867073e9577731ac34027d
Blueprint: drop-namespace-packages
2015-01-21 21:09:33 -05:00
Ihar Hrachyshka db7371c3c2 Fixed docstring for Notifier
Drivers still belong to oslo.messaging.notify.drivers stevedore
namespace.

Change-Id: Ibb41d49992bf7d7f3ee0af16b46ada0411973747
2015-01-21 16:12:21 +01:00
Doug Hellmann e55a83e832 Move files out of the namespace package
Move the public API out of oslo.messaging to oslo_messaging. Retain
the ability to import from the old namespace package for backwards
compatibility for this release cycle.

bp/drop-namespace-packages

Co-authored-by: Mehdi Abaakouk <mehdi.abaakouk@enovance.com>
Change-Id: Ia562010c152a214f1c0fed767c82022c7c2c52e7
2015-01-12 12:50:41 -05:00