Skip to content

Commit

Permalink
Add SSL support for InfluxDB
Browse files Browse the repository at this point in the history
Without this one gets `influxdb.exceptions.InfluxDBClientError: 400: Client sent an HTTP request to an HTTPS server.`
Documentation can be found here: https://influxdb-python.readthedocs.io/en/latest/api-documentation.html#influxdbclient
  • Loading branch information
fignew authored and dwoz committed Dec 10, 2023
1 parent 84b8993 commit ffdb9eb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions salt/modules/influxdbmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
influxdb.port: 8086
influxdb.user: 'root'
influxdb.password: 'root'
influxdb.ssl: False
influxdb.verify_ssl: False
This data can also be passed into pillar. Options passed into opts will
overwrite options passed into pillar.
Expand Down Expand Up @@ -66,6 +68,8 @@ def _client(
influxdb_password=None,
influxdb_host=None,
influxdb_port=None,
influxdb_ssl=None,
influxdb_verify_ssl=None,
**client_args
):
if not influxdb_user:
Expand All @@ -76,6 +80,10 @@ def _client(
influxdb_host = __salt__["config.option"]("influxdb.host", "localhost")
if not influxdb_port:
influxdb_port = __salt__["config.option"]("influxdb.port", 8086)
if not influxdb_ssl:
influxdb_ssl = __salt__["config.option"]("influxdb.ssl", False)
if not influxdb_verify_ssl:
influxdb_ssl = __salt__["config.option"]("influxdb.verify_ssl", False)
for ignore in _STATE_INTERNAL_KEYWORDS:
if ignore in client_args:
del client_args[ignore]
Expand All @@ -84,6 +92,8 @@ def _client(
port=influxdb_port,
username=influxdb_user,
password=influxdb_password,
ssl=influxdb_ssl,
verify_ssl=influxdb_verify_ssl,
**client_args
)

Expand Down

0 comments on commit ffdb9eb

Please sign in to comment.