Browse code

Add new function get_from_global_requirements

Instead of specifying the version of a library in devstack, use the version from
global-requirements

Add new function get_from_global_requirements and use it
where it makes sense.

Change-Id: I6b2f062761ac05ef72fc6cc9993bc204faf06fa5

Joe Gordon authored on 2015/02/07 12:29:23
Showing 3 changed files
... ...
@@ -95,6 +95,17 @@ function pip_install {
95 95
     fi
96 96
 }
97 97
 
98
+# get version of a package from global requirements file
99
+# get_from_global_requirements <package>
100
+function get_from_global_requirements {
101
+    local package=$1
102
+    local required_pkg=$(grep -h ${package} $REQUIREMENTS_DIR/global-requirements.txt | cut -d\# -f1)
103
+    if [[ $required_pkg == ""  ]]; then
104
+        die $LINENO "Can't find package $package in requirements"
105
+    fi
106
+    echo $required_pkg
107
+}
108
+
98 109
 # should we use this library from their git repo, or should we let it
99 110
 # get pulled in via pip dependencies.
100 111
 function use_library_from_git {
... ...
@@ -182,8 +182,7 @@ function stop_horizon {
182 182
 # NOTE: It can be moved to common functions, but it is only used by compilation
183 183
 # of django_openstack_auth catalogs at the moment.
184 184
 function _prepare_message_catalog_compilation {
185
-    local babel_package=$(grep ^Babel $REQUIREMENTS_DIR/global-requirements.txt)
186
-    pip_install "$babel_package"
185
+    pip_install $(get_from_global_requirements Babel)
187 186
 }
188 187
 
189 188
 
... ...
@@ -96,7 +96,8 @@ function remove_disabled_extensions {
96 96
 # configure_tempest() - Set config files, create data dirs, etc
97 97
 function configure_tempest {
98 98
     # install testr since its used to process tempest logs
99
-    pip_install `grep -h testrepository $REQUIREMENTS_DIR/global-requirements.txt | cut -d\# -f1`
99
+    pip_install $(get_from_global_requirements testrepository)
100
+
100 101
     local image_lines
101 102
     local images
102 103
     local num_images