remove patch pkg and patching of influx

This commit is contained in:
m0duspwnens
2023-02-17 11:01:17 -05:00
parent 353b77cd59
commit 8b680693f4
7 changed files with 0 additions and 111 deletions

View File

@@ -1026,8 +1026,6 @@ upgrade_salt() {
else else
echo "Salt upgrade success." echo "Salt upgrade success."
echo "" echo ""
echo "Removing /opt/so/state files for patched Salt InfluxDB module and state. This is due to Salt being upgraded and needing to patch the files again."
rm -vrf /opt/so/state/influxdb_continuous_query.py.patched /opt/so/state/influxdb_retention_policy.py.patched /opt/so/state/influxdbmod.py.patched
fi fi
} }
@@ -1138,9 +1136,7 @@ fix_wazuh() {
# Update the repo files so it can actually upgrade # Update the repo files so it can actually upgrade
upgrade_salt upgrade_salt
fi fi
rm -f /opt/so/state/influxdb_continuous_query.py.patched /opt/so/state/influxdbmod.py.patched /opt/so/state/influxdb_retention_policy.py.patched
systemctl_func "start" "salt-master" systemctl_func "start" "salt-master"
salt-call state.apply salt.python3-influxdb -l info
systemctl_func "start" "salt-minion" systemctl_func "start" "salt-minion"
systemctl_func "start" "$cron_service_name" systemctl_func "start" "$cron_service_name"
@@ -1309,11 +1305,6 @@ main() {
salt-call state.show_top -l error queue=True || fail "salt-master could not be reached. Check $SOUP_LOG for details." salt-call state.show_top -l error queue=True || fail "salt-master could not be reached. Check $SOUP_LOG for details."
set -e set -e
echo ""
echo "Ensuring python modules for Salt are installed and patched."
salt-call state.apply salt.python3-influxdb -l info queue=True
echo ""
# update the salt-minion configs here and start the minion # update the salt-minion configs here and start the minion
# since highstate are disabled above, minion start should not trigger a highstate # since highstate are disabled above, minion start should not trigger a highstate
echo "" echo ""

View File

@@ -14,7 +14,6 @@
include: include:
- salt.minion - salt.minion
- salt.python3-influxdb
- ssl - ssl
# Influx DB # Influx DB
@@ -111,7 +110,6 @@ telegraf_database:
- influxdb_host: {{ GLOBALS.manager }} - influxdb_host: {{ GLOBALS.manager }}
- require: - require:
- docker_container: so-influxdb - docker_container: so-influxdb
- sls: salt.python3-influxdb
- http: wait_for_influxdb - http: wait_for_influxdb
{% for rp in influxdb.retention_policies.keys() %} {% for rp in influxdb.retention_policies.keys() %}
@@ -131,7 +129,6 @@ telegraf_database:
- docker_container: so-influxdb - docker_container: so-influxdb
- influxdb_database: telegraf_database - influxdb_database: telegraf_database
- file: influxdb_retention_policy.present_patch - file: influxdb_retention_policy.present_patch
- sls: salt.python3-influxdb
{% endfor %} {% endfor %}
{% for dest_rp in influxdb.downsample.keys() %} {% for dest_rp in influxdb.downsample.keys() %}

View File

@@ -1,3 +0,0 @@
patch_package:
pkg.installed:
- name: patch

View File

@@ -10,7 +10,6 @@
include: include:
- salt - salt
- salt.helper-packages
- systemd.reload - systemd.reload
- repo.client - repo.client
@@ -34,21 +33,6 @@ install_salt_minion:
exec 2>&- # close stderr exec 2>&- # close stderr
nohup /bin/sh -c '{{ UPGRADECOMMAND }}' & nohup /bin/sh -c '{{ UPGRADECOMMAND }}' &
{# if we are the salt master #}
{% if grains.id.split('_')|first == grains.master %}
remove_influxdb_continuous_query_state_file:
file.absent:
- name: /opt/so/state/influxdb_continuous_query.py.patched
remove_influxdbmod_state_file:
file.absent:
- name: /opt/so/state/influxdbmod.py.patched
remove_influxdb_retention_policy_state_file:
file.absent:
- name: /opt/so/state/influxdb_retention_policy.py.patched
{% endif %}
{% endif %} {% endif %}
{% if INSTALLEDSALTVERSION|string == SALTVERSION|string %} {% if INSTALLEDSALTVERSION|string == SALTVERSION|string %}
@@ -115,8 +99,3 @@ salt_minion_service:
- file: salt_minion_service_unit_file - file: salt_minion_service_unit_file
{% endif %} {% endif %}
- order: last - order: last
patch_pkg:
pkg.installed:
- name: patch

View File

@@ -1,70 +0,0 @@
{% from "salt/map.jinja" import SALT_STATE_CODE_PATH with context %}
{% from "salt/map.jinja" import SALT_MODULE_CODE_PATH with context %}
{% from "salt/map.jinja" import PYTHON3INFLUX with context %}
{% from "salt/map.jinja" import PYTHON3INFLUXDEPS with context %}
{% from "salt/map.jinja" import PYTHONINSTALLER with context %}
include:
- salt.helper-packages
python3_influxdb_dependencies:
{{PYTHONINSTALLER}}.installed:
- pkgs: {{ PYTHON3INFLUXDEPS }}
python3_influxdb:
{{PYTHONINSTALLER}}.installed:
- name: {{ PYTHON3INFLUX }}
# We circumvent the file.patch state putting ERROR in the log by using the unless and file.touch below
# https://github.com/saltstack/salt/pull/47010 and https://github.com/saltstack/salt/issues/52329
#https://github.com/saltstack/salt/issues/59766
influxdb_continuous_query.present_patch:
file.patch:
- name: {{ SALT_STATE_CODE_PATH }}/influxdb_continuous_query.py
- source: salt://salt/files/influxdb_continuous_query.py.patch
- require:
- {{PYTHONINSTALLER}}: python3_influxdb
- pkg: patch_package
- unless: ls /opt/so/state/influxdb_continuous_query.py.patched
influxdb_continuous_query.py.patched:
file.touch:
- name: /opt/so/state/influxdb_continuous_query.py.patched
- onchanges:
- file: influxdb_continuous_query.present_patch
#https://github.com/saltstack/salt/issues/59761
influxdb_retention_policy.present_patch:
file.patch:
- name: {{ SALT_STATE_CODE_PATH }}/influxdb_retention_policy.py
- source: salt://salt/files/influxdb_retention_policy.py.patch
- require:
- {{PYTHONINSTALLER}}: python3_influxdb
- pkg: patch_package
- unless: ls /opt/so/state/influxdb_retention_policy.py.patched
influxdb_retention_policy.py.patched:
file.touch:
- name: /opt/so/state/influxdb_retention_policy.py.patched
- onchanges:
- file: influxdb_retention_policy.present_patch
# We should be able to set reload_modules: True in this state in order to tell salt to reload its python modules due to us possibly installing
# and possibly modifying modules in this state. This is bugged according to https://github.com/saltstack/salt/issues/24925
influxdbmod.py_shard_duration_patch:
file.patch:
- name: {{ SALT_MODULE_CODE_PATH }}/influxdbmod.py
- source: salt://salt/files/influxdbmod.py.patch
- require:
- {{PYTHONINSTALLER}}: python3_influxdb
- pkg: patch_package
- unless: ls /opt/so/state/influxdbmod.py.patched
influxdbmod.py.patched:
file.touch:
- name: /opt/so/state/influxdbmod.py.patched
- onchanges:
- file: influxdbmod.py_shard_duration_patch

View File

@@ -1795,10 +1795,6 @@ reinstall_init() {
# Backup /opt/so since we'll be rebuilding this directory during setup # Backup /opt/so since we'll be rebuilding this directory during setup
backup_dir /opt/so "$date_string" backup_dir /opt/so "$date_string"
# We need to restore these files during a reinstall so python3-influxdb state doesn't try to patch again
restore_file "/opt/so_old_$date_string/state/influxdb_continuous_query.py.patched" "/opt/so/state/"
restore_file "/opt/so_old_$date_string/state/influxdb_retention_policy.py.patched" "/opt/so/state/"
restore_file "/opt/so_old_$date_string/state/influxdbmod.py.patched" "/opt/so/state/"
# If the elastic license has been accepted restore the state file # If the elastic license has been accepted restore the state file
restore_file "/opt/so_old_$date_string/state/yeselastic.txt" "/opt/so/state/" restore_file "/opt/so_old_$date_string/state/yeselastic.txt" "/opt/so/state/"

View File

@@ -577,7 +577,6 @@ if ! [[ -f $install_opt_file ]]; then
logCmd "salt-call state.show_top" logCmd "salt-call state.show_top"
logCmd "salt-key -ya $MINION_ID" logCmd "salt-key -ya $MINION_ID"
logCmd "salt-call state.apply salt.helper-packages"
logCmd "salt-call state.apply common.packages" logCmd "salt-call state.apply common.packages"
logCmd "salt-call state.apply common" logCmd "salt-call state.apply common"
logCmd "salt-call state.apply docker" logCmd "salt-call state.apply docker"