Browse code

Adjust support for upcoming rootwrap changes

Adjust the recently-added support for upcoming nova-rootwrap changes to
match the latest proposed implementation. We now have a rootwrap.conf
configuration files that must point to the directory where the filters
are actually defined.

See https://review.openstack.org/#/c/8747/1 for the Nova change that
justifies this.

Change-Id: I20f2bff0f9e87cb11d58f083a326656c4a124bf1

Thierry Carrez authored on 2012/06/21 01:17:03
Showing 1 changed files
... ...
@@ -1194,19 +1194,26 @@ sudo chown `whoami` $NOVA_CONF_DIR
1194 1194
 
1195 1195
 cp -p $NOVA_DIR/etc/nova/policy.json $NOVA_CONF_DIR
1196 1196
 
1197
-# If Nova ships the new rootwrap.d config files, deploy them
1197
+# If Nova ships the new rootwrap filters files, deploy them
1198 1198
 # (owned by root) and add a parameter to $NOVA_ROOTWRAP
1199 1199
 ROOTWRAP_SUDOER_CMD="$NOVA_ROOTWRAP"
1200
-if [[ -d $NOVA_DIR/etc/nova/rootwrap.d ]]; then
1200
+if [[ -d $NOVA_DIR/etc/nova/rootwrap ]]; then
1201 1201
     # Wipe any existing rootwrap.d files first
1202 1202
     if [[ -d $NOVA_CONF_DIR/rootwrap.d ]]; then
1203 1203
         sudo rm -rf $NOVA_CONF_DIR/rootwrap.d
1204 1204
     fi
1205
+    # Deploy filters to /etc/nova/rootwrap.d
1205 1206
     sudo mkdir -m 755 $NOVA_CONF_DIR/rootwrap.d
1206
-    sudo cp $NOVA_DIR/etc/nova/rootwrap.d/* $NOVA_CONF_DIR/rootwrap.d
1207
+    sudo cp $NOVA_DIR/etc/nova/rootwrap/*.filters $NOVA_CONF_DIR/rootwrap.d
1207 1208
     sudo chown -R root:root $NOVA_CONF_DIR/rootwrap.d
1208 1209
     sudo chmod 644 $NOVA_CONF_DIR/rootwrap.d/*
1209
-    NOVA_ROOTWRAP="$NOVA_ROOTWRAP $NOVA_CONF_DIR/rootwrap.d"
1210
+    # Set up rootwrap.conf, pointing to /etc/nova/rootwrap.d
1211
+    sudo cp $NOVA_DIR/etc/nova/rootwrap.conf $NOVA_CONF_DIR/
1212
+    sudo sed -e "s:^path=.*$:path=$NOVA_CONF_DIR/rootwrap.d:" -i $NOVA_CONF_DIR/rootwrap.conf
1213
+    sudo chown root:root $NOVA_CONF_DIR/rootwrap.conf
1214
+    sudo chmod 0644 $NOVA_CONF_DIR/rootwrap.conf
1215
+    # Specify rootwrap.conf as first parameter to nova-rootwrap
1216
+    NOVA_ROOTWRAP="$NOVA_ROOTWRAP $NOVA_CONF_DIR/rootwrap.conf"
1210 1217
     ROOTWRAP_SUDOER_CMD="$NOVA_ROOTWRAP *"
1211 1218
 fi
1212 1219