Sync openstack-common.

This commit is contained in:
Adam Gandelman 2013-04-26 14:48:49 -07:00
parent 3af89e50d0
commit c8515a2a01

View File

@ -20,6 +20,9 @@ function service_ctl_status {
function service_ctl { function service_ctl {
# control a specific service, or all (as defined by $SERVICES) # control a specific service, or all (as defined by $SERVICES)
# service restarts will only occur depending on global $CONFIG_CHANGED,
# which should be updated in charm's set_or_update().
local config_changed=${CONFIG_CHANGED:-True}
if [[ $1 == "all" ]] ; then if [[ $1 == "all" ]] ; then
ctl="$SERVICES" ctl="$SERVICES"
else else
@ -37,12 +40,21 @@ function service_ctl {
"stop") "stop")
service_ctl_status $i && service $i stop || return 0 ;; service_ctl_status $i && service $i stop || return 0 ;;
"restart") "restart")
service_ctl_status $i && service $i restart || service $i start ;; if [[ "$config_changed" == "True" ]] ; then
service_ctl_status $i && service $i restart || service $i start
fi
;;
esac esac
if [[ $? != 0 ]] ; then if [[ $? != 0 ]] ; then
juju-log "$CHARM: service_ctl ERROR - Service $i failed to $action" juju-log "$CHARM: service_ctl ERROR - Service $i failed to $action"
fi fi
done done
# all configs should have been reloaded on restart of all services, reset
# flag if its being used.
if [[ "$action" == "restart" ]] && [[ -n "$CONFIG_CHANGED" ]] &&
[[ "$ctl" == "all" ]]; then
CONFIG_CHANGED="False"
fi
} }
function configure_install_source { function configure_install_source {