Skip to content

Commit ce5b8ed

Browse files
committed
Support upcoming rootwrap.d config files
Add support in devstack for upcoming /etc/nova/rootwrap.d configuration files. Note that we don't change anything if Nova doesn't ship them, so devstack supports both cases. This is the first step for blueprint folsom-nova-rootwrap. It needs to go in first so that tests pass when rootwrap.d changes will be proposed in Nova. Change-Id: I0189575ed9adb1be61c8563ce8f3199c52fc08ff
1 parent c634ccd commit ce5b8ed

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

stack.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,9 +1178,25 @@ sudo chown `whoami` $NOVA_CONF_DIR
11781178

11791179
cp -p $NOVA_DIR/etc/nova/policy.json $NOVA_CONF_DIR
11801180

1181+
# If Nova ships the new rootwrap.d config files, deploy them
1182+
# (owned by root) and add a parameter to $NOVA_ROOTWRAP
1183+
ROOTWRAP_SUDOER_CMD="$NOVA_ROOTWRAP"
1184+
if [[ -d $NOVA_DIR/etc/nova/rootwrap.d ]]; then
1185+
# Wipe any existing rootwrap.d files first
1186+
if [[ -d $NOVA_CONF_DIR/rootwrap.d ]]; then
1187+
sudo rm -rf $NOVA_CONF_DIR/rootwrap.d
1188+
fi
1189+
sudo mkdir -m 755 $NOVA_CONF_DIR/rootwrap.d
1190+
sudo cp $NOVA_DIR/etc/nova/rootwrap.d/* $NOVA_CONF_DIR/rootwrap.d
1191+
sudo chown -R root:root $NOVA_CONF_DIR/rootwrap.d
1192+
sudo chmod 644 $NOVA_CONF_DIR/rootwrap.d/*
1193+
NOVA_ROOTWRAP="$NOVA_ROOTWRAP $NOVA_CONF_DIR/rootwrap.d"
1194+
ROOTWRAP_SUDOER_CMD="$NOVA_ROOTWRAP *"
1195+
fi
1196+
11811197
# Set up the rootwrap sudoers
11821198
TEMPFILE=`mktemp`
1183-
echo "$USER ALL=(root) NOPASSWD: $NOVA_ROOTWRAP" >$TEMPFILE
1199+
echo "$USER ALL=(root) NOPASSWD: $ROOTWRAP_SUDOER_CMD" >$TEMPFILE
11841200
chmod 0440 $TEMPFILE
11851201
sudo chown root:root $TEMPFILE
11861202
sudo mv $TEMPFILE /etc/sudoers.d/nova-rootwrap

0 commit comments

Comments
 (0)