diff --git a/salt/influxdb/init.sls b/salt/influxdb/init.sls index 609263bb5..cda095a31 100644 --- a/salt/influxdb/init.sls +++ b/salt/influxdb/init.sls @@ -7,6 +7,9 @@ {% set IMAGEREPO = salt['pillar.get']('global:imagerepo') %} {% import_yaml 'influxdb/defaults.yaml' as default_settings %} {% 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 %} @@ -63,6 +66,8 @@ append_so-influxdb_so-status.conf: - name: /opt/so/conf/so-status/so-status.conf - 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: http.query: - name: 'https://{{MANAGER}}:8086/query?q=SHOW+DATABASES' @@ -124,6 +129,7 @@ so_downsample_cq: - sls: salt.python3-influxdb {% endfor %} +{% endif %} {% endif %} {% else %} diff --git a/salt/salt/python3-influxdb.sls b/salt/salt/python3-influxdb.sls index f65a0c6b4..acadf2161 100644 --- a/salt/salt/python3-influxdb.sls +++ b/salt/salt/python3-influxdb.sls @@ -33,11 +33,12 @@ influxdb_retention_policy.present_patch: - {{PYTHONINSTALLER}}: python3_influxdb - 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: file.patch: - name: {{ SALT_MODULE_CODE_PATH }}/influxdbmod.py - source: salt://salt/files/influxdbmod.py.patch - require: - {{PYTHONINSTALLER}}: python3_influxdb - - pkg: patch_package - - reload_modules: True \ No newline at end of file + - pkg: patch_package \ No newline at end of file