Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Influx V1 test query #37309

Merged
merged 1 commit into from
Jul 2, 2020
Merged

Conversation

mdegat01
Copy link
Contributor

@mdegat01 mdegat01 commented Jul 2, 2020

Proposed change

Recent refactoring PR #37232 created a serious issue with the Influx sensor. The test query to determine connectivity with Influx V1 was SHOW SERIES LIMIT 1;. I thought that this query was one that worked with or without a database specified and thus could just be used to determine connectivity with the server, similar to how buckets() is used with V2 Influx. This is incorrect, database is not optional. Therefore when used during initial setup to test connectivity outside of the context of any particular sensor this can break.

This PR simply changes the query to SHOW DATABASES; which does work in this context. It always returns the list of databases the currently authenticated user can see based on privileges. Will follow this up with another PR to use this info to validate the sensors are pointing to valid databases/buckets but for now just fixing the introduced bug.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

V1:

# Example configuration.yaml
sensor:
- platform: influxdb
  host: localhost
  username: !secret user
  password: !secret pass
  queries:
  - name: test
    unit_of_measurement: W
    group_function: last
    where: '"domain" = ''binary_sensor'''
    measurement: 'units'
    field: value
    database: Test

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@probot-home-assistant
Copy link

Hey there @fabaff, mind taking a look at this pull request as its been labeled with an integration (influxdb) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@MartinHjelmare MartinHjelmare changed the title Fixed Influx V1 test query (bugfix) Fix Influx V1 test query Jul 2, 2020
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mdegat01
Copy link
Contributor Author

mdegat01 commented Jul 2, 2020

@MartinHjelmare ok if we merge this one? Want to unblock the issue owner as well as any other beta users using the sensor with InfluxDB V1.

@MartinHjelmare
Copy link
Member

MartinHjelmare commented Jul 2, 2020

Note that the refactor is not included in the beta or latest release. It's just on dev.

@MartinHjelmare MartinHjelmare merged commit 0a982f6 into home-assistant:dev Jul 2, 2020
@mdegat01 mdegat01 deleted the issue-37294 branch July 2, 2020 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HA 0.113.0.dev20200701 - InfluxDB not accessible
4 participants