Skip to content

[BUG] 3002.5 influxdb_continuous_query.present state not passing **client_args to influxdb.create_continuous_query module #59766

@m0duspwnens

Description

@m0duspwnens

Description
The influxdb_continuous_query.present state is not passing **client_args to the influxdb.create_continuous_query module. This creates an issue when trying to create a continuous query on an SSL enabled InfluxDB.

Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info).

downsample_cpu_cq:
  influxdb_continuous_query.present:
    - name: downsample_cpu_cq
    - database: telegraf
    - ssl: True
    - query: SELECT mean(*) INTO "long_term"."cpu" FROM "cpu" GROUP BY time(30m)

Steps to Reproduce the behavior
Create the state above, and apply it. The following output will be received:

          ID: downsample_cpu_cq
    Function: influxdb_continuous_query.present
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python3.6/site-packages/salt/state.py", line 2154, in call
                  *cdata["args"], **cdata["kwargs"]
                File "/usr/lib/python3.6/site-packages/salt/loader.py", line 2106, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python3.6/site-packages/salt/states/influxdb_continuous_query.py", line 60, in present
                  database, name, query, resample_time, coverage_period
                File "/usr/lib/python3.6/site-packages/salt/modules/influxdbmod.py", line 659, in create_continuous_query
                  client.query(query)
                File "/root/.local/lib/python3.6/site-packages/influxdb/client.py", line 527, in query
                  expected_response_code=expected_response_code
                File "/root/.local/lib/python3.6/site-packages/influxdb/client.py", line 378, in request
                  raise InfluxDBClientError(err_msg, response.status_code)
              influxdb.exceptions.InfluxDBClientError: 400: Client sent an HTTP request to an HTTPS server.
     Started: 16:59:27.937636
    Duration: 50.238 ms
     Changes:

Expected behavior
It is expected that the continuous query would be created.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3002.5

Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.8.1
     docker-py: 2.6.1
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.11.1
       libgit2: Not Installed
      M2Crypto: 0.35.2
          Mako: Not Installed
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: 1.3.12
     pycparser: Not Installed
      pycrypto: Not Installed
  pycryptodome: Not Installed
        pygit2: Not Installed
        Python: 3.6.8 (default, Nov 16 2020, 16:55:22)
  python-gnupg: Not Installed
        PyYAML: 3.13
         PyZMQ: 17.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.1.4

System Versions:
          dist: centos 7 Core
        locale: UTF-8
       machine: x86_64
       release: 3.10.0-1160.15.2.el7.x86_64
        system: Linux
       version: CentOS Linux 7 Core

Additional context
The issue appears to be on line 60 in influxdb_continuous_query.py database, name, query, resample_time, coverage_period should be database, name, query, resample_time, coverage_period, **client_args. When testing the change locally, the expected output is produced:

          ID: downsample_cpu_cq
    Function: influxdb_continuous_query.present
      Result: True
     Comment: continuous query downsample_cpu_cq has been created
     Started: 17:03:14.444281
    Duration: 86.889 ms
     Changes:
              ----------
              downsample_cpu_cq:
                  Present

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions