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

Enhance Kapacitor module and state. #46294

Merged
merged 9 commits into from Mar 8, 2018

Conversation

Projects
None yet
2 participants
@AAbouZaid
Copy link
Contributor

commented Mar 2, 2018

What does this PR do?

Current Kapacitor module and state are missing some functionality.

This PR has following:

  • TICK script could be defined to access more than 1 database/retention policy.
  • Set Kapacitor URL (in case kapacitord doesn't listen to localhost).
  • Support for URL using https and use http by default.
  • Support for -skipVerify option to allow "Unsafe SSL".

Tests written?

Yes

Commits signed with GPG?

Yes

@rallytime
Copy link
Contributor

left a comment

Hi @AAbouZaid - I have a couple of requests and one question on this change. Thanks!

@@ -105,6 +121,7 @@ def _run_cmd(cmd):
def define_task(name,
tick_script,
task_type='stream',
dbrps=None,

This comment has been minimized.

Copy link
@rallytime

rallytime Mar 6, 2018

Contributor

Can you move this new kwarg to the end of the list? We don't want to change the API unnecessarily here.

@@ -32,6 +34,7 @@ def __virtual__():
def task_present(name,
tick_script,
task_type='stream',
dbrps=None,

This comment has been minimized.

Copy link
@rallytime

rallytime Mar 6, 2018

Contributor

Same comment here as above.

A list of databases and retention policies in "dbname"."rpname" format
to fetch data from. For backward compatibility, the value of
'database' and 'retention_policy' will be merged as part of dbrps.

This comment has been minimized.

Copy link
@rallytime

rallytime Mar 6, 2018

Contributor

Can you add a .. versionadded:: Fluorine tag to these docs (and do the same for the docs in the module)?

This comment has been minimized.

Copy link
@AAbouZaid

AAbouZaid Mar 7, 2018

Author Contributor

Sure, but how I can add it for mixed sections like this:

'''
Kapacitor state module.

:configuration: This module accepts connection configuration details either as
    parameters or as configuration settings in /etc/salt/minion on the relevant
    minions::

        kapacitor.unsafe_ssl: 'false'
        kapacitor.protocol: 'http'
        kapacitor.host: 'localhost'
        kapacitor.port: 9092

    This data can also be passed into pillar. Options passed into opts will
    overwrite options passed into pillar.

.. versionadded:: 2016.11.0
'''

Since kapacitor.unsafe_ssl and kapacitor.protocol are new, but rest are old (2016.11.0)

This comment has been minimized.

Copy link
@rallytime

rallytime Mar 7, 2018

Contributor

Good question. I think you can put that in the configuration block, indented. But I am not sure on what the formatting will look like. It might just be prudent to add a comment in that configuration block stating that those options are new to Fluorine.

@@ -63,6 +71,7 @@ def task_present(name,

task = __salt__['kapacitor.get_task'](name)
old_script = task['script'] if task else ''
task_dbrps = [{'db': dbrp[0], 'rp': dbrp[1]} for dbrp in (dbrp.split('.') for dbrp in dbrps)]

This comment has been minimized.

Copy link
@rallytime

rallytime Mar 6, 2018

Contributor

How does this change things for people specifying database and retention_policy and not dbrps? It seems like this would change the default behavior.

AAbouZaid added some commits Mar 7, 2018

@rallytime rallytime merged commit 65cee66 into saltstack:develop Mar 8, 2018

4 of 10 checks passed

jenkins/PR/salt-pr-linode-cent7-py3 Pull Requests » Salt PR - Linode CentOS 7 - PY3 #2981 — ABORTED
Details
codeclimate 2 issues to fix
Details
jenkins/PR/salt-pr-linode-ubuntu14-n Pull Requests » Salt PR - Linode Ubuntu14.04 #20631 — FAILURE
Details
jenkins/PR/salt-pr-linode-ubuntu16-py3 Pull Requests » Salt PR - Linode Ubuntu16.04 - PY3 #7686 — FAILURE
Details
jenkins/PR/salt-pr-rs-cent7-n Pull Requests » Salt PR - RS CentOS 7 #17029 — FAILURE
Details
default Build started sha1 is merged.
Details
WIP ready for review
Details
jenkins/PR/salt-pr-clone Pull Requests » Salt PR - Clone #23035 — SUCCESS
Details
jenkins/PR/salt-pr-docs-n Pull Requests » Salt PR - Docs #15351 — SUCCESS
Details
jenkins/PR/salt-pr-lint-n Pull Requests » Salt PR - Code Lint #19964 — SUCCESS
Details
'database' and 'retention_policy' will be merged as part of dbrps.
.. versionadded:: Fluorine
database
Which database to fetch data from. Defaults to None, which will use the

This comment has been minimized.

Copy link
@AAbouZaid

AAbouZaid Mar 9, 2018

Author Contributor

database
Which database to fetch data from. Defaults to None, which will use the
default database in InfluxDB.

@rallytime btw, I believe this (allow empty database) has never been "really" true, it has been changed on 28.10.2015 which means that happened even before the major change in v0.13.

Therefore, I will change this too.

This comment has been minimized.

Copy link
@rallytime

rallytime Mar 9, 2018

Contributor

Ok sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.