From c6782413081cbdc72c7b24e34acec383a1cf2f46 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 14 May 2015 10:01:53 +1000 Subject: [PATCH] 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 --- inc/rootwrap | 14 ++++++++++---- lib/ceilometer | 2 +- lib/cinder | 2 +- lib/nova | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/inc/rootwrap b/inc/rootwrap index bac8e1e86c..411e5f7b73 100644 --- a/inc/rootwrap +++ b/inc/rootwrap @@ -38,11 +38,17 @@ function add_sudo_secure_path { # Configure rootwrap # Make a load of assumptions otherwise we'll have 6 arguments -# configure_rootwrap project bin conf-src-dir +# configure_rootwrap project function configure_rootwrap { - local project=$1 # xx - local rootwrap_bin=$2 # /opt/stack/xx.venv/bin/xx-rootwrap - local rootwrap_conf_src_dir=$3 # /opt/stack/xx/etc/xx + local project=$1 + local project_uc=$(echo $1|tr a-z A-Z) + local bin_dir="${project_uc}_BIN_DIR" + bin_dir="${!bin_dir}" + local project_dir="${project_uc}_DIR" + project_dir="${!project_dir}" + + local rootwrap_conf_src_dir="${project_dir}/etc/${project}" + local rootwrap_bin="${bin_dir}/${project}-rootwrap" # Start fresh with rootwrap filters sudo rm -rf /etc/${project}/rootwrap.d diff --git a/lib/ceilometer b/lib/ceilometer index 9abdbfe286..1f72187ed6 100644 --- a/lib/ceilometer +++ b/lib/ceilometer @@ -254,7 +254,7 @@ function configure_ceilometer { if is_service_enabled ceilometer-aipmi; then # Configure rootwrap for the ipmi agent - configure_rootwrap ceilometer $CEILOMETER_BIN_DIR/ceilometer-rootwrap $CEILOMETER_DIR/etc/ceilometer + configure_rootwrap ceilometer fi } diff --git a/lib/cinder b/lib/cinder index eb0e1d7600..3c5425af08 100644 --- a/lib/cinder +++ b/lib/cinder @@ -190,7 +190,7 @@ function configure_cinder { rm -f $CINDER_CONF - configure_rootwrap cinder $CINDER_BIN_DIR/cinder-rootwrap $CINDER_DIR/etc/cinder + configure_rootwrap cinder cp $CINDER_DIR/etc/cinder/api-paste.ini $CINDER_API_PASTE_INI diff --git a/lib/nova b/lib/nova index 7d2145b170..da288d3e4d 100644 --- a/lib/nova +++ b/lib/nova @@ -298,7 +298,7 @@ function configure_nova { install_default_policy nova - configure_rootwrap nova $NOVA_BIN_DIR/nova-rootwrap $NOVA_DIR/etc/nova + configure_rootwrap nova if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then # Get the sample configuration file in place