Clean up remainders of USE_SYSTEMD and logging setup
We dropped the ability to override USE_SYSTEMD to False when we deleted screen support in [0], so we can also clean up any conditionals based on it. Also clean up the logging setup functions, dropping local vars for parameters that we don't actually support anymore. [0] I8c27182f60b0f5310b3a8bf5feb02beb7ffbb26a Change-Id: I5cbce9f2c42e111761e8689447b3f8cbb7ea2eb5
This commit is contained in:
parent
46fd644897
commit
6808a3468d
4
clean.sh
4
clean.sh
@ -123,12 +123,10 @@ if [[ -n "$LOGDIR" ]] && [[ -d "$LOGDIR" ]]; then
|
|||||||
sudo rm -rf $LOGDIR
|
sudo rm -rf $LOGDIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean out the systemd user unit files if systemd was used.
|
# Clean out the systemd unit files.
|
||||||
if [[ "$USE_SYSTEMD" = "True" ]]; then
|
|
||||||
sudo find $SYSTEMD_DIR -type f -name '*devstack@*service' -delete
|
sudo find $SYSTEMD_DIR -type f -name '*devstack@*service' -delete
|
||||||
# Make systemd aware of the deletion.
|
# Make systemd aware of the deletion.
|
||||||
$SYSTEMCTL daemon-reload
|
$SYSTEMCTL daemon-reload
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean up venvs
|
# Clean up venvs
|
||||||
DIRS_TO_CLEAN="$WHEELHOUSE ${PROJECT_VENV[@]} .config/openstack"
|
DIRS_TO_CLEAN="$WHEELHOUSE ${PROJECT_VENV[@]} .config/openstack"
|
||||||
|
43
functions
43
functions
@ -635,40 +635,29 @@ function vercmp {
|
|||||||
# This sets up defaults we like in devstack for logging for tracking
|
# This sets up defaults we like in devstack for logging for tracking
|
||||||
# down issues, and makes sure everything is done the same between
|
# down issues, and makes sure everything is done the same between
|
||||||
# projects.
|
# projects.
|
||||||
|
# NOTE(jh): Historically this function switched between three different
|
||||||
|
# functions: setup_systemd_logging, setup_colorized_logging and
|
||||||
|
# setup_standard_logging_identity. Since we always run with systemd now,
|
||||||
|
# this could be cleaned up, but the other functions may still be in use
|
||||||
|
# by plugins. Since deprecations haven't worked in the past, we'll just
|
||||||
|
# leave them in place.
|
||||||
function setup_logging {
|
function setup_logging {
|
||||||
local conf_file=$1
|
setup_systemd_logging $1
|
||||||
local other_cond=${2:-"False"}
|
|
||||||
if [[ "$USE_SYSTEMD" == "True" ]]; then
|
|
||||||
setup_systemd_logging $conf_file
|
|
||||||
elif [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && [ "$other_cond" == "False" ]; then
|
|
||||||
setup_colorized_logging $conf_file
|
|
||||||
else
|
|
||||||
setup_standard_logging_identity $conf_file
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function sets log formatting options for colorizing log
|
# This function sets log formatting options for colorizing log
|
||||||
# output to stdout. It is meant to be called by lib modules.
|
# output to stdout. It is meant to be called by lib modules.
|
||||||
# The last two parameters are optional and can be used to specify
|
|
||||||
# non-default value for project and user format variables.
|
|
||||||
# Defaults are respectively 'project_name' and 'user_name'
|
|
||||||
#
|
|
||||||
# setup_colorized_logging something.conf SOMESECTION
|
|
||||||
function setup_colorized_logging {
|
function setup_colorized_logging {
|
||||||
local conf_file=$1
|
local conf_file=$1
|
||||||
local conf_section="DEFAULT"
|
|
||||||
local project_var="project_name"
|
|
||||||
local user_var="user_name"
|
|
||||||
# Add color to logging output
|
# Add color to logging output
|
||||||
iniset $conf_file $conf_section logging_context_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[01;36m%(request_id)s [00;36m%("$project_var")s %("$user_var")s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
|
iniset $conf_file DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[01;36m%(request_id)s [00;36m%(project_name)s %(user_name)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
|
||||||
iniset $conf_file $conf_section logging_default_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
|
iniset $conf_file DEFAULT logging_default_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
|
||||||
iniset $conf_file $conf_section logging_debug_format_suffix "[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m"
|
iniset $conf_file DEFAULT logging_debug_format_suffix "[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m"
|
||||||
iniset $conf_file $conf_section logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m"
|
iniset $conf_file DEFAULT logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m"
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_systemd_logging {
|
function setup_systemd_logging {
|
||||||
local conf_file=$1
|
local conf_file=$1
|
||||||
local conf_section="DEFAULT"
|
|
||||||
# NOTE(sdague): this is a nice to have, and means we're using the
|
# NOTE(sdague): this is a nice to have, and means we're using the
|
||||||
# native systemd path, which provides for things like search on
|
# native systemd path, which provides for things like search on
|
||||||
# request-id. However, there may be an eventlet interaction here,
|
# request-id. However, there may be an eventlet interaction here,
|
||||||
@ -676,16 +665,16 @@ function setup_systemd_logging {
|
|||||||
USE_JOURNAL=$(trueorfalse False USE_JOURNAL)
|
USE_JOURNAL=$(trueorfalse False USE_JOURNAL)
|
||||||
local pidstr=""
|
local pidstr=""
|
||||||
if [[ "$USE_JOURNAL" == "True" ]]; then
|
if [[ "$USE_JOURNAL" == "True" ]]; then
|
||||||
iniset $conf_file $conf_section use_journal "True"
|
iniset $conf_file DEFAULT use_journal "True"
|
||||||
# if we are using the journal directly, our process id is already correct
|
# if we are using the journal directly, our process id is already correct
|
||||||
else
|
else
|
||||||
pidstr="(pid=%(process)d) "
|
pidstr="(pid=%(process)d) "
|
||||||
fi
|
fi
|
||||||
iniset $conf_file $conf_section logging_debug_format_suffix "[00;33m{{${pidstr}%(funcName)s %(pathname)s:%(lineno)d}}[00m"
|
iniset $conf_file DEFAULT logging_debug_format_suffix "[00;33m{{${pidstr}%(funcName)s %(pathname)s:%(lineno)d}}[00m"
|
||||||
|
|
||||||
iniset $conf_file $conf_section logging_context_format_string "%(color)s%(levelname)s %(name)s [[01;36m%(global_request_id)s %(request_id)s [00;36m%(project_name)s %(user_name)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
|
iniset $conf_file DEFAULT logging_context_format_string "%(color)s%(levelname)s %(name)s [[01;36m%(global_request_id)s %(request_id)s [00;36m%(project_name)s %(user_name)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
|
||||||
iniset $conf_file $conf_section logging_default_format_string "%(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
|
iniset $conf_file DEFAULT logging_default_format_string "%(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
|
||||||
iniset $conf_file $conf_section logging_exception_prefix "ERROR %(name)s [01;35m%(instance)s[00m"
|
iniset $conf_file DEFAULT logging_exception_prefix "ERROR %(name)s [01;35m%(instance)s[00m"
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_standard_logging_identity {
|
function setup_standard_logging_identity {
|
||||||
|
5
stack.sh
5
stack.sh
@ -803,13 +803,11 @@ fixup_all
|
|||||||
# Install subunit for the subunit output stream
|
# Install subunit for the subunit output stream
|
||||||
pip_install -U os-testr
|
pip_install -U os-testr
|
||||||
|
|
||||||
if [[ "$USE_SYSTEMD" == "True" ]]; then
|
|
||||||
pip_install_gr systemd-python
|
pip_install_gr systemd-python
|
||||||
# the default rate limit of 1000 messages / 30 seconds is not
|
# the default rate limit of 1000 messages / 30 seconds is not
|
||||||
# sufficient given how verbose our logging is.
|
# sufficient given how verbose our logging is.
|
||||||
iniset -sudo /etc/systemd/journald.conf "Journal" "RateLimitBurst" "0"
|
iniset -sudo /etc/systemd/journald.conf "Journal" "RateLimitBurst" "0"
|
||||||
sudo systemctl restart systemd-journald
|
sudo systemctl restart systemd-journald
|
||||||
fi
|
|
||||||
|
|
||||||
# Virtual Environment
|
# Virtual Environment
|
||||||
# -------------------
|
# -------------------
|
||||||
@ -1521,14 +1519,11 @@ if [[ -n "$DEPRECATED_TEXT" ]]; then
|
|||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If USE_SYSTEMD is enabled, tell the user about using it.
|
|
||||||
if [[ "$USE_SYSTEMD" == "True" ]]; then
|
|
||||||
echo
|
echo
|
||||||
echo "Services are running under systemd unit files."
|
echo "Services are running under systemd unit files."
|
||||||
echo "For more information see: "
|
echo "For more information see: "
|
||||||
echo "https://docs.openstack.org/devstack/latest/systemd.html"
|
echo "https://docs.openstack.org/devstack/latest/systemd.html"
|
||||||
echo
|
echo
|
||||||
fi
|
|
||||||
|
|
||||||
# Useful info on current state
|
# Useful info on current state
|
||||||
cat /etc/devstack-version
|
cat /etc/devstack-version
|
||||||
|
4
stackrc
4
stackrc
@ -109,9 +109,7 @@ CELLSV2_SETUP=${CELLSV2_SETUP:-"superconductor"}
|
|||||||
# Set the root URL for Horizon
|
# Set the root URL for Horizon
|
||||||
HORIZON_APACHE_ROOT="/dashboard"
|
HORIZON_APACHE_ROOT="/dashboard"
|
||||||
|
|
||||||
# Whether to use SYSTEMD to manage services, we only do this from
|
# Whether to use user specific units for running services or global ones.
|
||||||
# Queens forward.
|
|
||||||
USE_SYSTEMD="True"
|
|
||||||
USER_UNITS=$(trueorfalse False USER_UNITS)
|
USER_UNITS=$(trueorfalse False USER_UNITS)
|
||||||
if [[ "$USER_UNITS" == "True" ]]; then
|
if [[ "$USER_UNITS" == "True" ]]; then
|
||||||
SYSTEMD_DIR="$HOME/.local/share/systemd/user"
|
SYSTEMD_DIR="$HOME/.local/share/systemd/user"
|
||||||
|
Loading…
Reference in New Issue
Block a user