Browse Source

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
Thomas Herve 2 years ago
parent
commit
cc7f3daace
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      devstack/plugin.sh

+ 5
- 3
devstack/plugin.sh View File

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

Loading…
Cancel
Save