combine local and default pillars to get pillar values locally

This commit is contained in:
m0duspwnens
2022-02-28 14:35:16 -05:00
parent dc24cb711d
commit 80e5198f9e

View File

@@ -266,8 +266,17 @@ check_log_size_limit() {
local current_limit
echo "getting log_size_limit pillar in check_log_size_limit"
current_limit=$(lookup_pillar "log_size_limit" "elasticsearch")
# since it is possible for the salt-master service to be stopped when this is run, we need to check the pillar values locally
# we need to combine default local and default pillars before doing this so we can define --pillar-root in salt-call
local epoch_date=$(date +%s%N)
mkdir -p /opt/so/saltstack/soup_tmp_${epoch_date}/
cp -r /opt/so/saltstack/default/pillar/ /opt/so/saltstack/soup_tmp_${epoch_date}/
# use \cp here to overwrite any pillar files from default with those in local for the tmp directory
\cp -r /opt/so/saltstack/local/pillar/ /opt/so/saltstack/soup_tmp_${epoch_date}/
current_limit=$(salt-call pillar.get elasticsearch:log_size_limit --local --pillar-root=/opt/so/saltstack/soup_tmp_${epoch_date}/pillar)
echo "found log_size_limit to be $current_limit"
rm -rf /opt/so/saltstack/soup_tmp_${epoch_date}/
local percent
case $node_type in