mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
ensure proper version of python3-influxdb is installed prior to running the states that require it
This commit is contained in:
@@ -7,6 +7,9 @@
|
|||||||
{% set IMAGEREPO = salt['pillar.get']('global:imagerepo') %}
|
{% set IMAGEREPO = salt['pillar.get']('global:imagerepo') %}
|
||||||
{% import_yaml 'influxdb/defaults.yaml' as default_settings %}
|
{% import_yaml 'influxdb/defaults.yaml' as default_settings %}
|
||||||
{% set influxdb = salt['grains.filter_by'](default_settings, default='influxdb', merge=salt['pillar.get']('influxdb', {})) %}
|
{% set influxdb = salt['grains.filter_by'](default_settings, default='influxdb', merge=salt['pillar.get']('influxdb', {})) %}
|
||||||
|
{% from 'salt/map.jinja' import PYTHON3INFLUX with context %}
|
||||||
|
{% set PYTHONINFLUXVERSION = PYTHON3INFLUX.split("==")[1] | trim %}
|
||||||
|
{% set PYTHONINFLUXVERSIONINSTALLED = salt['cmd.run']("python3 -c 'import influxdb; print (influxdb.__version__)'", python_shell=True) | trim %}
|
||||||
|
|
||||||
{% if grains['role'] in ['so-manager', 'so-managersearch', 'so-eval', 'so-standalone'] and GRAFANA == 1 %}
|
{% if grains['role'] in ['so-manager', 'so-managersearch', 'so-eval', 'so-standalone'] and GRAFANA == 1 %}
|
||||||
|
|
||||||
@@ -63,6 +66,8 @@ append_so-influxdb_so-status.conf:
|
|||||||
- name: /opt/so/conf/so-status/so-status.conf
|
- name: /opt/so/conf/so-status/so-status.conf
|
||||||
- text: so-influxdb
|
- text: so-influxdb
|
||||||
|
|
||||||
|
# We have to make sure the influxdb module is the right version prior to state run since reload_modules is bugged
|
||||||
|
{% if PYTHONINFLUXVERSIONINSTALLED == PYTHONINFLUXVERSION %}
|
||||||
wait_for_influxdb:
|
wait_for_influxdb:
|
||||||
http.query:
|
http.query:
|
||||||
- name: 'https://{{MANAGER}}:8086/query?q=SHOW+DATABASES'
|
- name: 'https://{{MANAGER}}:8086/query?q=SHOW+DATABASES'
|
||||||
@@ -124,6 +129,7 @@ so_downsample_cq:
|
|||||||
- sls: salt.python3-influxdb
|
- sls: salt.python3-influxdb
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ influxdb_retention_policy.present_patch:
|
|||||||
- {{PYTHONINSTALLER}}: python3_influxdb
|
- {{PYTHONINSTALLER}}: python3_influxdb
|
||||||
- pkg: patch_package
|
- pkg: patch_package
|
||||||
|
|
||||||
|
# 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:
|
influxdbmod.py_shard_duration_patch:
|
||||||
file.patch:
|
file.patch:
|
||||||
- name: {{ SALT_MODULE_CODE_PATH }}/influxdbmod.py
|
- name: {{ SALT_MODULE_CODE_PATH }}/influxdbmod.py
|
||||||
@@ -40,4 +42,3 @@ influxdbmod.py_shard_duration_patch:
|
|||||||
- require:
|
- require:
|
||||||
- {{PYTHONINSTALLER}}: python3_influxdb
|
- {{PYTHONINSTALLER}}: python3_influxdb
|
||||||
- pkg: patch_package
|
- pkg: patch_package
|
||||||
- reload_modules: True
|
|
||||||
Reference in New Issue
Block a user