Browse code

Add basic echo_* functions for grenade

Grenade, and possibly other components, re-use parts of devstack
libraries. This provides basic echo_* functions to avoid missing
commands in several libraries.

Change-Id: I972d6208055a8c4ca4c9bfd5383ad3c7159d5cbe

Ian Wienand authored on 2014/06/03 15:05:12
Showing 1 changed files
... ...
@@ -16,6 +16,10 @@ source ${FUNC_DIR}/functions-common
16 16
 XTRACE=$(set +o | grep xtrace)
17 17
 set +o xtrace
18 18
 
19
+# Check if a function already exists
20
+function function_exists {
21
+    declare -f -F $1 > /dev/null
22
+}
19 23
 
20 24
 # Checks if installed Apache is <= given version
21 25
 # $1 = x.y.z (version string of Apache)
... ...
@@ -527,6 +531,20 @@ function setup_colorized_logging {
527 527
     iniset $conf_file $conf_section logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s %(instance)s"
528 528
 }
529 529
 
530
+# These functions are provided for basic fall-back functionality for
531
+# projects that include parts of devstack (grenade).  stack.sh will
532
+# override these with more specific versions for devstack (with fancy
533
+# spinners, etc).  We never override an existing version
534
+if ! function_exists echo_summary; then
535
+    function echo_summary {
536
+        echo $@
537
+    }
538
+fi
539
+if ! function_exists echo_nolog; then
540
+    function echo_nolog {
541
+        echo $@
542
+    }
543
+fi
530 544
 
531 545
 # Restore xtrace
532 546
 $XTRACE