From 8421c2b9ab5d8242abb7d1bdc20435408db8b802 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Mon, 16 Mar 2015 13:52:19 -0500 Subject: [PATCH] Use install(1) where possible This eliminated a number of sudo calls by doing the copy/chown/chmod in a single step and sets a common pattern. Change-Id: I9c8f48854d5bc443cc187df0948c28b82c4d2838 --- lib/ceilometer | 9 ++------- lib/cinder | 21 ++++++++------------- lib/glance | 18 +++--------------- lib/heat | 16 ++++------------ lib/ironic | 17 ++++------------- lib/keystone | 11 +++-------- lib/neutron | 20 ++++++-------------- lib/nova | 27 ++++++++++----------------- lib/sahara | 10 ++-------- lib/swift | 10 ++++------ lib/tempest | 8 ++------ lib/trove | 5 +---- lib/zaqar | 6 ++---- 13 files changed, 51 insertions(+), 127 deletions(-) diff --git a/lib/ceilometer b/lib/ceilometer index 9db0640940..318c5467cf 100644 --- a/lib/ceilometer +++ b/lib/ceilometer @@ -163,11 +163,7 @@ function _config_ceilometer_apache_wsgi { # configure_ceilometer() - Set config files, create data dirs, etc function configure_ceilometer { - [ ! -d $CEILOMETER_CONF_DIR ] && sudo mkdir -m 755 -p $CEILOMETER_CONF_DIR - sudo chown $STACK_USER $CEILOMETER_CONF_DIR - - [ ! -d $CEILOMETER_API_LOG_DIR ] && sudo mkdir -m 755 -p $CEILOMETER_API_LOG_DIR - sudo chown $STACK_USER $CEILOMETER_API_LOG_DIR + sudo install -d -o $STACK_USER -m 755 $CEILOMETER_CONF_DIR $CEILOMETER_API_LOG_DIR iniset_rpc_backend ceilometer $CEILOMETER_CONF DEFAULT @@ -267,8 +263,7 @@ function configure_mongodb { # init_ceilometer() - Initialize etc. function init_ceilometer { # Create cache dir - sudo mkdir -p $CEILOMETER_AUTH_CACHE_DIR - sudo chown $STACK_USER $CEILOMETER_AUTH_CACHE_DIR + sudo install -d -o $STACK_USER $CEILOMETER_AUTH_CACHE_DIR rm -f $CEILOMETER_AUTH_CACHE_DIR/* if is_service_enabled mysql postgresql; then diff --git a/lib/cinder b/lib/cinder index 880af1fd40..51f0163e44 100644 --- a/lib/cinder +++ b/lib/cinder @@ -174,16 +174,15 @@ function configure_cinder_rootwrap { if [[ -d $CINDER_CONF_DIR/rootwrap.d ]]; then sudo rm -rf $CINDER_CONF_DIR/rootwrap.d fi + # Deploy filters to /etc/cinder/rootwrap.d - sudo mkdir -m 755 $CINDER_CONF_DIR/rootwrap.d - sudo cp $CINDER_DIR/etc/cinder/rootwrap.d/*.filters $CINDER_CONF_DIR/rootwrap.d - sudo chown -R root:root $CINDER_CONF_DIR/rootwrap.d - sudo chmod 644 $CINDER_CONF_DIR/rootwrap.d/* + sudo install -d -o root -g root -m 755 $CINDER_CONF_DIR/rootwrap.d + sudo install -o root -g root -m 644 $CINDER_DIR/etc/cinder/rootwrap.d/*.filters $CINDER_CONF_DIR/rootwrap.d + # Set up rootwrap.conf, pointing to /etc/cinder/rootwrap.d - sudo cp $CINDER_DIR/etc/cinder/rootwrap.conf $CINDER_CONF_DIR/ + sudo install -o root -g root -m 644 $CINDER_DIR/etc/cinder/rootwrap.conf $CINDER_CONF_DIR sudo sed -e "s:^filters_path=.*$:filters_path=$CINDER_CONF_DIR/rootwrap.d:" -i $CINDER_CONF_DIR/rootwrap.conf - sudo chown root:root $CINDER_CONF_DIR/rootwrap.conf - sudo chmod 0644 $CINDER_CONF_DIR/rootwrap.conf + # Specify rootwrap.conf as first parameter to rootwrap ROOTWRAP_CSUDOER_CMD="$cinder_rootwrap $CINDER_CONF_DIR/rootwrap.conf *" @@ -197,10 +196,7 @@ function configure_cinder_rootwrap { # configure_cinder() - Set config files, create data dirs, etc function configure_cinder { - if [[ ! -d $CINDER_CONF_DIR ]]; then - sudo mkdir -p $CINDER_CONF_DIR - fi - sudo chown $STACK_USER $CINDER_CONF_DIR + sudo install -d -o $STACK_USER -m 755 $CINDER_CONF_DIR cp -p $CINDER_DIR/etc/cinder/policy.json $CINDER_CONF_DIR @@ -351,8 +347,7 @@ function create_cinder_accounts { # create_cinder_cache_dir() - Part of the init_cinder() process function create_cinder_cache_dir { # Create cache dir - sudo mkdir -p $CINDER_AUTH_CACHE_DIR - sudo chown $STACK_USER $CINDER_AUTH_CACHE_DIR + sudo install -d -o $STACK_USER $CINDER_AUTH_CACHE_DIR rm -f $CINDER_AUTH_CACHE_DIR/* } diff --git a/lib/glance b/lib/glance index eb1df2e8ae..db3de17232 100755 --- a/lib/glance +++ b/lib/glance @@ -90,15 +90,7 @@ function cleanup_glance { # configure_glance() - Set config files, create data dirs, etc function configure_glance { - if [[ ! -d $GLANCE_CONF_DIR ]]; then - sudo mkdir -p $GLANCE_CONF_DIR - fi - sudo chown $STACK_USER $GLANCE_CONF_DIR - - if [[ ! -d $GLANCE_METADEF_DIR ]]; then - sudo mkdir -p $GLANCE_METADEF_DIR - fi - sudo chown $STACK_USER $GLANCE_METADEF_DIR + sudo install -d -o $STACK_USER $GLANCE_CONF_DIR $GLANCE_METADEF_DIR # Copy over our glance configurations and update them cp $GLANCE_DIR/etc/glance-registry.conf $GLANCE_REGISTRY_CONF @@ -263,12 +255,8 @@ function create_glance_accounts { # create_glance_cache_dir() - Part of the init_glance() process function create_glance_cache_dir { # Create cache dir - sudo mkdir -p $GLANCE_AUTH_CACHE_DIR/api - sudo chown $STACK_USER $GLANCE_AUTH_CACHE_DIR/api - rm -f $GLANCE_AUTH_CACHE_DIR/api/* - sudo mkdir -p $GLANCE_AUTH_CACHE_DIR/registry - sudo chown $STACK_USER $GLANCE_AUTH_CACHE_DIR/registry - rm -f $GLANCE_AUTH_CACHE_DIR/registry/* + sudo install -d -o $STACK_USER $GLANCE_AUTH_CACHE_DIR/api $GLANCE_AUTH_CACHE_DIR/registry + rm -f $GLANCE_AUTH_CACHE_DIR/api/* $GLANCE_AUTH_CACHE_DIR/registry/* } # init_glance() - Initialize databases, etc. diff --git a/lib/heat b/lib/heat index a088e82886..d75652ab7b 100644 --- a/lib/heat +++ b/lib/heat @@ -85,10 +85,7 @@ function configure_heat { setup_develop $HEAT_DIR/contrib/heat_keystoneclient_v2 fi - if [[ ! -d $HEAT_CONF_DIR ]]; then - sudo mkdir -p $HEAT_CONF_DIR - fi - sudo chown $STACK_USER $HEAT_CONF_DIR + sudo install -d -o $STACK_USER $HEAT_CONF_DIR # remove old config files rm -f $HEAT_CONF_DIR/heat-*.conf @@ -172,15 +169,11 @@ function configure_heat { iniset $HEAT_CONF DEFAULT enable_stack_abandon true fi - # heat environment - sudo mkdir -p $HEAT_ENV_DIR - sudo chown $STACK_USER $HEAT_ENV_DIR + sudo install -d -o $STACK_USER $HEAT_ENV_DIR $HEAT_TEMPLATES_DIR + # copy the default environment cp $HEAT_DIR/etc/heat/environment.d/* $HEAT_ENV_DIR/ - # heat template resources. - sudo mkdir -p $HEAT_TEMPLATES_DIR - sudo chown $STACK_USER $HEAT_TEMPLATES_DIR # copy the default templates cp $HEAT_DIR/etc/heat/templates/* $HEAT_TEMPLATES_DIR/ @@ -199,8 +192,7 @@ function init_heat { # create_heat_cache_dir() - Part of the init_heat() process function create_heat_cache_dir { # Create cache dirs - sudo mkdir -p $HEAT_AUTH_CACHE_DIR - sudo chown $STACK_USER $HEAT_AUTH_CACHE_DIR + sudo install -d -o $STACK_USER $HEAT_AUTH_CACHE_DIR } # install_heatclient() - Collect source and prepare diff --git a/lib/ironic b/lib/ironic index 35b5411cd4..2fddc54b63 100644 --- a/lib/ironic +++ b/lib/ironic @@ -233,22 +233,14 @@ function cleanup_ironic { # configure_ironic_dirs() - Create all directories required by Ironic and # associated services. function configure_ironic_dirs { - if [[ ! -d $IRONIC_CONF_DIR ]]; then - sudo mkdir -p $IRONIC_CONF_DIR - fi + sudo install -d -o $STACK_USER $IRONIC_CONF_DIR $STACK_USER $IRONIC_DATA_DIR \ + $IRONIC_STATE_PATH $IRONIC_TFTPBOOT_DIR $IRONIC_TFTPBOOT_DIR/pxelinux.cfg + sudo chown -R $STACK_USER:$LIBVIRT_GROUP $IRONIC_TFTPBOOT_DIR if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then - sudo mkdir -p $IRONIC_HTTP_DIR - sudo chown -R $STACK_USER:$LIBVIRT_GROUP $IRONIC_HTTP_DIR + sudo install -d -o $STACK_USER -g $LIBVIRT_GROUP $IRONIC_HTTP_DIR fi - sudo mkdir -p $IRONIC_DATA_DIR - sudo mkdir -p $IRONIC_STATE_PATH - sudo mkdir -p $IRONIC_TFTPBOOT_DIR - sudo chown -R $STACK_USER $IRONIC_DATA_DIR $IRONIC_STATE_PATH - sudo chown -R $STACK_USER:$LIBVIRT_GROUP $IRONIC_TFTPBOOT_DIR - mkdir -p $IRONIC_TFTPBOOT_DIR/pxelinux.cfg - if [ ! -f $IRONIC_PXE_BOOT_IMAGE ]; then die $LINENO "PXE boot file $IRONIC_PXE_BOOT_IMAGE not found." fi @@ -267,7 +259,6 @@ function configure_ironic_dirs { # configure_ironic() - Set config files, create data dirs, etc function configure_ironic { configure_ironic_dirs - sudo chown $STACK_USER $IRONIC_CONF_DIR # Copy over ironic configuration file and configure common parameters. cp $IRONIC_DIR/etc/ironic/ironic.conf.sample $IRONIC_CONF_FILE diff --git a/lib/keystone b/lib/keystone index 0968445dc0..9dfdc608d4 100644 --- a/lib/keystone +++ b/lib/keystone @@ -175,14 +175,10 @@ function _config_keystone_apache_wsgi { # configure_keystone() - Set config files, create data dirs, etc function configure_keystone { - if [[ ! -d $KEYSTONE_CONF_DIR ]]; then - sudo mkdir -p $KEYSTONE_CONF_DIR - fi - sudo chown $STACK_USER $KEYSTONE_CONF_DIR + sudo install -d -o $STACK_USER $KEYSTONE_CONF_DIR if [[ "$KEYSTONE_CONF_DIR" != "$KEYSTONE_DIR/etc" ]]; then - cp -p $KEYSTONE_DIR/etc/keystone.conf.sample $KEYSTONE_CONF - chmod 600 $KEYSTONE_CONF + install -m 600 $KEYSTONE_DIR/etc/keystone.conf.sample $KEYSTONE_CONF cp -p $KEYSTONE_DIR/etc/policy.json $KEYSTONE_CONF_DIR if [[ -f "$KEYSTONE_DIR/etc/keystone-paste.ini" ]]; then cp -p "$KEYSTONE_DIR/etc/keystone-paste.ini" "$KEYSTONE_PASTE_INI" @@ -490,8 +486,7 @@ function init_keystone { $KEYSTONE_DIR/bin/keystone-manage pki_setup # Create cache dir - sudo mkdir -p $KEYSTONE_AUTH_CACHE_DIR - sudo chown $STACK_USER $KEYSTONE_AUTH_CACHE_DIR + sudo install -d -o $STACK_USER $KEYSTONE_AUTH_CACHE_DIR rm -f $KEYSTONE_AUTH_CACHE_DIR/* fi } diff --git a/lib/neutron b/lib/neutron index e41abafda9..d0463d8089 100755 --- a/lib/neutron +++ b/lib/neutron @@ -495,8 +495,7 @@ function create_nova_conf_neutron { # create_neutron_cache_dir() - Part of the _neutron_setup_keystone() process function create_neutron_cache_dir { # Create cache dir - sudo mkdir -p $NEUTRON_AUTH_CACHE_DIR - sudo chown $STACK_USER $NEUTRON_AUTH_CACHE_DIR + sudo install -d -o $STACK_USER $NEUTRON_AUTH_CACHE_DIR rm -f $NEUTRON_AUTH_CACHE_DIR/* } @@ -800,10 +799,7 @@ function cleanup_neutron { function _create_neutron_conf_dir { # Put config files in ``NEUTRON_CONF_DIR`` for everyone to find - if [[ ! -d $NEUTRON_CONF_DIR ]]; then - sudo mkdir -p $NEUTRON_CONF_DIR - fi - sudo chown $STACK_USER $NEUTRON_CONF_DIR + sudo install -d -o $STACK_USER $NEUTRON_CONF_DIR } # _configure_neutron_common() @@ -1075,10 +1071,8 @@ function _neutron_service_plugin_class_add { # _neutron_deploy_rootwrap_filters() - deploy rootwrap filters to $Q_CONF_ROOTWRAP_D (owned by root). function _neutron_deploy_rootwrap_filters { local srcdir=$1 - mkdir -p -m 755 $Q_CONF_ROOTWRAP_D - sudo cp -pr $srcdir/etc/neutron/rootwrap.d/* $Q_CONF_ROOTWRAP_D/ - sudo chown -R root:root $Q_CONF_ROOTWRAP_D - sudo chmod 644 $Q_CONF_ROOTWRAP_D/* + sudo install -d -o root -m 755 $Q_CONF_ROOTWRAP_D + sudo install -o root -m 644 $srcdir/etc/neutron/rootwrap.d/* $Q_CONF_ROOTWRAP_D/ } # _neutron_setup_rootwrap() - configure Neutron's rootwrap @@ -1097,13 +1091,11 @@ function _neutron_setup_rootwrap { # Set up ``rootwrap.conf``, pointing to ``$NEUTRON_CONF_DIR/rootwrap.d`` # location moved in newer versions, prefer new location if test -r $NEUTRON_DIR/etc/neutron/rootwrap.conf; then - sudo cp -p $NEUTRON_DIR/etc/neutron/rootwrap.conf $Q_RR_CONF_FILE + sudo install -o root -g root -m 644 $NEUTRON_DIR/etc/neutron/rootwrap.conf $Q_RR_CONF_FILE else - sudo cp -p $NEUTRON_DIR/etc/rootwrap.conf $Q_RR_CONF_FILE + sudo install -o root -g root -m 644 $NEUTRON_DIR/etc/rootwrap.conf $Q_RR_CONF_FILE fi sudo sed -e "s:^filters_path=.*$:filters_path=$Q_CONF_ROOTWRAP_D:" -i $Q_RR_CONF_FILE - sudo chown root:root $Q_RR_CONF_FILE - sudo chmod 0644 $Q_RR_CONF_FILE # Specify ``rootwrap.conf`` as first parameter to neutron-rootwrap ROOTWRAP_SUDOER_CMD="$NEUTRON_ROOTWRAP $Q_RR_CONF_FILE *" diff --git a/lib/nova b/lib/nova index 199daeea3d..e850fe9daf 100644 --- a/lib/nova +++ b/lib/nova @@ -232,16 +232,15 @@ function configure_nova_rootwrap { if [[ -d $NOVA_CONF_DIR/rootwrap.d ]]; then sudo rm -rf $NOVA_CONF_DIR/rootwrap.d fi + # Deploy filters to /etc/nova/rootwrap.d - sudo mkdir -m 755 $NOVA_CONF_DIR/rootwrap.d - sudo cp $NOVA_DIR/etc/nova/rootwrap.d/*.filters $NOVA_CONF_DIR/rootwrap.d - sudo chown -R root:root $NOVA_CONF_DIR/rootwrap.d - sudo chmod 644 $NOVA_CONF_DIR/rootwrap.d/* + sudo install -d -o root -g root -m 755 $NOVA_CONF_DIR/rootwrap.d + sudo install -o root -g root -m 644 $NOVA_DIR/etc/nova/rootwrap.d/*.filters $NOVA_CONF_DIR/rootwrap.d + # Set up rootwrap.conf, pointing to /etc/nova/rootwrap.d - sudo cp $NOVA_DIR/etc/nova/rootwrap.conf $NOVA_CONF_DIR/ + sudo install -o root -g root -m 644 $NOVA_DIR/etc/nova/rootwrap.conf $NOVA_CONF_DIR sudo sed -e "s:^filters_path=.*$:filters_path=$NOVA_CONF_DIR/rootwrap.d:" -i $NOVA_CONF_DIR/rootwrap.conf - sudo chown root:root $NOVA_CONF_DIR/rootwrap.conf - sudo chmod 0644 $NOVA_CONF_DIR/rootwrap.conf + # Specify rootwrap.conf as first parameter to nova-rootwrap local rootwrap_sudoer_cmd="$NOVA_ROOTWRAP $NOVA_CONF_DIR/rootwrap.conf *" @@ -256,10 +255,7 @@ function configure_nova_rootwrap { # configure_nova() - Set config files, create data dirs, etc function configure_nova { # Put config files in ``/etc/nova`` for everyone to find - if [[ ! -d $NOVA_CONF_DIR ]]; then - sudo mkdir -p $NOVA_CONF_DIR - fi - sudo chown $STACK_USER $NOVA_CONF_DIR + sudo install -d -o $STACK_USER $NOVA_CONF_DIR cp -p $NOVA_DIR/etc/nova/policy.json $NOVA_CONF_DIR @@ -318,8 +314,7 @@ function configure_nova { # ---------------- # Nova stores each instance in its own directory. - sudo mkdir -p $NOVA_INSTANCES_PATH - sudo chown -R $STACK_USER $NOVA_INSTANCES_PATH + sudo install -d -o $STACK_USER $NOVA_INSTANCES_PATH # You can specify a different disk to be mounted and used for backing the # virtual machines. If there is a partition labeled nova-instances we @@ -603,8 +598,7 @@ function init_nova_cells { # create_nova_cache_dir() - Part of the init_nova() process function create_nova_cache_dir { # Create cache dir - sudo mkdir -p $NOVA_AUTH_CACHE_DIR - sudo chown $STACK_USER $NOVA_AUTH_CACHE_DIR + sudo install -d -o $STACK_USER $NOVA_AUTH_CACHE_DIR rm -f $NOVA_AUTH_CACHE_DIR/* } @@ -621,8 +615,7 @@ function create_nova_conf_nova_network { # create_nova_keys_dir() - Part of the init_nova() process function create_nova_keys_dir { # Create keys dir - sudo mkdir -p ${NOVA_STATE_PATH}/keys - sudo chown -R $STACK_USER ${NOVA_STATE_PATH} + sudo install -d -o $STACK_USER ${NOVA_STATE_PATH} ${NOVA_STATE_PATH}/keys } # init_nova() - Initialize databases, etc. diff --git a/lib/sahara b/lib/sahara index 521b19a4a1..f389326a6f 100644 --- a/lib/sahara +++ b/lib/sahara @@ -101,11 +101,7 @@ function cleanup_sahara { # configure_sahara() - Set config files, create data dirs, etc function configure_sahara { - - if [[ ! -d $SAHARA_CONF_DIR ]]; then - sudo mkdir -p $SAHARA_CONF_DIR - fi - sudo chown $STACK_USER $SAHARA_CONF_DIR + sudo install -d -o $STACK_USER $SAHARA_CONF_DIR if [[ -f $SAHARA_DIR/etc/sahara/policy.json ]]; then cp -p $SAHARA_DIR/etc/sahara/policy.json $SAHARA_CONF_DIR @@ -115,9 +111,7 @@ function configure_sahara { cp $SAHARA_DIR/etc/sahara/sahara.conf.sample $SAHARA_CONF_FILE # Create auth cache dir - sudo mkdir -p $SAHARA_AUTH_CACHE_DIR - sudo chown $STACK_USER $SAHARA_AUTH_CACHE_DIR - sudo chmod 700 $SAHARA_AUTH_CACHE_DIR + sudo install -d -o $STACK_USER -m 700 $SAHARA_AUTH_CACHE_DIR rm -rf $SAHARA_AUTH_CACHE_DIR/* configure_auth_token_middleware $SAHARA_CONF_FILE sahara $SAHARA_AUTH_CACHE_DIR diff --git a/lib/swift b/lib/swift index 4a63500b54..9781e862db 100644 --- a/lib/swift +++ b/lib/swift @@ -306,8 +306,8 @@ function configure_swift { # Make sure to kill all swift processes first swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true - sudo mkdir -p ${SWIFT_CONF_DIR}/{object,container,account}-server - sudo chown -R ${STACK_USER}: ${SWIFT_CONF_DIR} + sudo install -d -o ${STACK_USER} ${SWIFT_CONF_DIR} + sudo install -d -o ${STACK_USER} ${SWIFT_CONF_DIR}/{object,container,account}-server if [[ "$SWIFT_CONF_DIR" != "/etc/swift" ]]; then # Some swift tools are hard-coded to use ``/etc/swift`` and are apparently not going to be fixed. @@ -534,8 +534,7 @@ function create_swift_disk { # changing the permissions so we can run it as our user. local user_group=$(id -g ${STACK_USER}) - sudo mkdir -p ${SWIFT_DATA_DIR}/{drives,cache,run,logs} - sudo chown -R ${STACK_USER}:${user_group} ${SWIFT_DATA_DIR} + sudo install -d -o ${STACK_USER} -g ${user_group} ${SWIFT_DATA_DIR}/{drives,cache,run,logs} # Create a loopback disk and format it to XFS. if [[ -e ${SWIFT_DISK_IMAGE} ]]; then @@ -675,8 +674,7 @@ function init_swift { } && popd >/dev/null # Create cache dir - sudo mkdir -p $SWIFT_AUTH_CACHE_DIR - sudo chown $STACK_USER $SWIFT_AUTH_CACHE_DIR + sudo install -d -o ${STACK_USER} $SWIFT_AUTH_CACHE_DIR rm -f $SWIFT_AUTH_CACHE_DIR/* } diff --git a/lib/tempest b/lib/tempest index f856ce05f9..99cfc5857b 100644 --- a/lib/tempest +++ b/lib/tempest @@ -170,12 +170,8 @@ function configure_tempest { # Create tempest.conf from tempest.conf.sample # copy every time, because the image UUIDS are going to change - if [[ ! -d $TEMPEST_CONFIG_DIR ]]; then - sudo mkdir -p $TEMPEST_CONFIG_DIR - fi - sudo chown $STACK_USER $TEMPEST_CONFIG_DIR - cp $TEMPEST_DIR/etc/tempest.conf.sample $TEMPEST_CONFIG - chmod 644 $TEMPEST_CONFIG + sudo install -d -o $STACK_USER $TEMPEST_CONFIG_DIR + install -m 644 $TEMPEST_DIR/etc/tempest.conf.sample $TEMPEST_CONFIG password=${ADMIN_PASSWORD:-secrete} diff --git a/lib/trove b/lib/trove index d77798308b..dab6dced54 100644 --- a/lib/trove +++ b/lib/trove @@ -121,10 +121,7 @@ function configure_trove { setup_develop $TROVE_DIR # Create the trove conf dir and cache dirs if they don't exist - sudo mkdir -p ${TROVE_CONF_DIR} - sudo mkdir -p ${TROVE_AUTH_CACHE_DIR} - sudo chown -R $STACK_USER: ${TROVE_CONF_DIR} - sudo chown -R $STACK_USER: ${TROVE_AUTH_CACHE_DIR} + sudo install -d -o $STACK_USER ${TROVE_CONF_DIR} ${TROVE_AUTH_CACHE_DIR} # Copy api-paste file over to the trove conf dir cp $TROVE_LOCAL_API_PASTE_INI $TROVE_API_PASTE_INI diff --git a/lib/zaqar b/lib/zaqar index 79b4c5a2ca..5f3f7bb20b 100644 --- a/lib/zaqar +++ b/lib/zaqar @@ -105,8 +105,7 @@ function configure_zaqarclient { function configure_zaqar { setup_develop $ZAQAR_DIR - [ ! -d $ZAQAR_CONF_DIR ] && sudo mkdir -m 755 -p $ZAQAR_CONF_DIR - sudo chown $USER $ZAQAR_CONF_DIR + sudo install -d -o $STACK_USER -m 755 $ZAQAR_CONF_DIR iniset $ZAQAR_CONF DEFAULT debug True iniset $ZAQAR_CONF DEFAULT verbose True @@ -168,8 +167,7 @@ function configure_mongodb { # init_zaqar() - Initialize etc. function init_zaqar { # Create cache dir - sudo mkdir -p $ZAQAR_AUTH_CACHE_DIR - sudo chown $STACK_USER $ZAQAR_AUTH_CACHE_DIR + sudo install -d -o $STACK_USER $ZAQAR_AUTH_CACHE_DIR rm -f $ZAQAR_AUTH_CACHE_DIR/* }