From 8b680693f4a38313184088de1cc957fe7ba48972 Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Fri, 17 Feb 2023 11:01:17 -0500 Subject: [PATCH] remove patch pkg and patching of influx --- salt/common/tools/sbin/soup | 9 ----- salt/influxdb/init.sls | 3 -- salt/salt/helper-packages.sls | 3 -- salt/salt/minion.sls | 21 ---------- salt/salt/python3-influxdb.sls | 70 ---------------------------------- setup/so-functions | 4 -- setup/so-setup | 1 - 7 files changed, 111 deletions(-) delete mode 100644 salt/salt/helper-packages.sls delete mode 100644 salt/salt/python3-influxdb.sls diff --git a/salt/common/tools/sbin/soup b/salt/common/tools/sbin/soup index 6bdd49661..1ee166657 100755 --- a/salt/common/tools/sbin/soup +++ b/salt/common/tools/sbin/soup @@ -1026,8 +1026,6 @@ upgrade_salt() { else echo "Salt upgrade success." 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 } @@ -1138,9 +1136,7 @@ fix_wazuh() { # Update the repo files so it can actually upgrade upgrade_salt 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" - salt-call state.apply salt.python3-influxdb -l info systemctl_func "start" "salt-minion" 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." 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 # since highstate are disabled above, minion start should not trigger a highstate echo "" diff --git a/salt/influxdb/init.sls b/salt/influxdb/init.sls index 4fe625209..6baabd047 100644 --- a/salt/influxdb/init.sls +++ b/salt/influxdb/init.sls @@ -14,7 +14,6 @@ include: - salt.minion - - salt.python3-influxdb - ssl # Influx DB @@ -111,7 +110,6 @@ telegraf_database: - influxdb_host: {{ GLOBALS.manager }} - require: - docker_container: so-influxdb - - sls: salt.python3-influxdb - http: wait_for_influxdb {% for rp in influxdb.retention_policies.keys() %} @@ -131,7 +129,6 @@ telegraf_database: - docker_container: so-influxdb - influxdb_database: telegraf_database - file: influxdb_retention_policy.present_patch - - sls: salt.python3-influxdb {% endfor %} {% for dest_rp in influxdb.downsample.keys() %} diff --git a/salt/salt/helper-packages.sls b/salt/salt/helper-packages.sls deleted file mode 100644 index 32480c163..000000000 --- a/salt/salt/helper-packages.sls +++ /dev/null @@ -1,3 +0,0 @@ -patch_package: - pkg.installed: - - name: patch diff --git a/salt/salt/minion.sls b/salt/salt/minion.sls index 50bb865df..5e06a361f 100644 --- a/salt/salt/minion.sls +++ b/salt/salt/minion.sls @@ -10,7 +10,6 @@ include: - salt - - salt.helper-packages - systemd.reload - repo.client @@ -34,21 +33,6 @@ install_salt_minion: exec 2>&- # close stderr 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 %} {% if INSTALLEDSALTVERSION|string == SALTVERSION|string %} @@ -115,8 +99,3 @@ salt_minion_service: - file: salt_minion_service_unit_file {% endif %} - order: last - - -patch_pkg: - pkg.installed: - - name: patch diff --git a/salt/salt/python3-influxdb.sls b/salt/salt/python3-influxdb.sls deleted file mode 100644 index 7a59c4303..000000000 --- a/salt/salt/python3-influxdb.sls +++ /dev/null @@ -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 - - diff --git a/setup/so-functions b/setup/so-functions index 0b4ba9fa1..a0ee4c0d5 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1795,10 +1795,6 @@ reinstall_init() { # Backup /opt/so since we'll be rebuilding this directory during setup 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 restore_file "/opt/so_old_$date_string/state/yeselastic.txt" "/opt/so/state/" diff --git a/setup/so-setup b/setup/so-setup index 9ecbed08c..9448a4011 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -577,7 +577,6 @@ if ! [[ -f $install_opt_file ]]; then logCmd "salt-call state.show_top" 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" logCmd "salt-call state.apply docker"