Protect rabbit transport definition

As it turns out, a plugin can be loaded several time during a CI run.
When it does so, the trick used to save the rabbit get_transport_url
method definition erases the previous version. This protects it by only
defining it once.

Change-Id: I7eb5a1934b4be87b289df8c78927852fc84aac18
This commit is contained in:
Thomas Herve 2017-03-07 16:51:46 +01:00
parent e8dfd2a928
commit cc7f3daace
1 changed files with 5 additions and 3 deletions

View File

@ -421,9 +421,11 @@ if is_service_enabled amqp1; then
fi
# Save rabbit get_transport_url for notifications if necessary
get_transport_url_definition=$(declare -f get_transport_url)
eval "_get_rabbit_transport_url() ${get_transport_url_definition#*\()}"
export -f _get_rabbit_transport_url
if [ ! $(type -t _get_rabbit_transport_url) ]; then
get_transport_url_definition=$(declare -f get_transport_url)
eval "_get_rabbit_transport_url() ${get_transport_url_definition#*\()}"
export -f _get_rabbit_transport_url
fi
# Note: this is the only tricky part about out of tree rpc plugins,
# you must overwrite the iniset_rpc_backend function so that when