Browse code

Infer rootwrap arguments from project

We can infer the binary and configuration paths just from the project
name and expanding this to the known *_DIR & *_BIN_DIR variables. A
similar thing is done for policyd settings

Change-Id: I7c6a9fa106948ae5cbcf52555ade6154623798f1

Ian Wienand authored on 2015/05/14 09:01:53
Showing 4 changed files
... ...
@@ -38,11 +38,17 @@ function add_sudo_secure_path {
38 38
 
39 39
 # Configure rootwrap
40 40
 # Make a load of assumptions otherwise we'll have 6 arguments
41
-# configure_rootwrap project bin conf-src-dir
41
+# configure_rootwrap project
42 42
 function configure_rootwrap {
43
-    local project=$1                    # xx
44
-    local rootwrap_bin=$2               # /opt/stack/xx.venv/bin/xx-rootwrap
45
-    local rootwrap_conf_src_dir=$3      # /opt/stack/xx/etc/xx
43
+    local project=$1
44
+    local project_uc=$(echo $1|tr a-z A-Z)
45
+    local bin_dir="${project_uc}_BIN_DIR"
46
+    bin_dir="${!bin_dir}"
47
+    local project_dir="${project_uc}_DIR"
48
+    project_dir="${!project_dir}"
49
+
50
+    local rootwrap_conf_src_dir="${project_dir}/etc/${project}"
51
+    local rootwrap_bin="${bin_dir}/${project}-rootwrap"
46 52
 
47 53
     # Start fresh with rootwrap filters
48 54
     sudo rm -rf /etc/${project}/rootwrap.d
... ...
@@ -254,7 +254,7 @@ function configure_ceilometer {
254 254
 
255 255
     if is_service_enabled ceilometer-aipmi; then
256 256
         # Configure rootwrap for the ipmi agent
257
-        configure_rootwrap ceilometer $CEILOMETER_BIN_DIR/ceilometer-rootwrap $CEILOMETER_DIR/etc/ceilometer
257
+        configure_rootwrap ceilometer
258 258
     fi
259 259
 }
260 260
 
... ...
@@ -190,7 +190,7 @@ function configure_cinder {
190 190
 
191 191
     rm -f $CINDER_CONF
192 192
 
193
-    configure_rootwrap cinder $CINDER_BIN_DIR/cinder-rootwrap $CINDER_DIR/etc/cinder
193
+    configure_rootwrap cinder
194 194
 
195 195
     cp $CINDER_DIR/etc/cinder/api-paste.ini $CINDER_API_PASTE_INI
196 196
 
... ...
@@ -298,7 +298,7 @@ function configure_nova {
298 298
 
299 299
     install_default_policy nova
300 300
 
301
-    configure_rootwrap nova $NOVA_BIN_DIR/nova-rootwrap $NOVA_DIR/etc/nova
301
+    configure_rootwrap nova
302 302
 
303 303
     if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
304 304
         # Get the sample configuration file in place