influxdb: fix missing arg specs (#33859)

* influxdb: fix missing arg specs

* influxdb: doc: move database_name spec to doc fragments

* influxdb: cleanup unused import
pull/33868/head
René Moser 7 years ago committed by GitHub
parent 20ce0bde30
commit 5bcc9cd1c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,9 @@
# Copyright: (c) 2017, Ansible Project # Copyright: (c) 2017, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) # Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
try: try:
import requests.exceptions import requests.exceptions
HAS_REQUESTS = True HAS_REQUESTS = True
@ -16,7 +19,7 @@ except ImportError:
HAS_INFLUXDB = False HAS_INFLUXDB = False
class InfluxDb(object): class InfluxDb():
def __init__(self, module): def __init__(self, module):
self.module = module self.module = module
self.params = self.module.params self.params = self.module.params
@ -44,9 +47,11 @@ class InfluxDb(object):
database_name=dict(required=True, type='str'), database_name=dict(required=True, type='str'),
ssl=dict(default=False, type='bool'), ssl=dict(default=False, type='bool'),
validate_certs=dict(default=True, type='bool'), validate_certs=dict(default=True, type='bool'),
timeout=dict(default=None, type='int'), timeout=dict(type='int'),
retries=dict(default=3, type='int'), retries=dict(default=3, type='int'),
proxies=dict(default={}, type='dict'), proxies=dict(default={}, type='dict'),
use_udp=dict(default=False, type='bool'),
udp_port=dict(type=int)
) )
def connect_to_influxdb(self): def connect_to_influxdb(self):

@ -25,17 +25,12 @@ requirements:
- "influxdb >= 0.9" - "influxdb >= 0.9"
- requests - requests
options: options:
database_name:
description:
- Name of the database that will be created/destroyed
required: true
state: state:
description: description:
- Determines if the database should be created or destroyed - Determines if the database should be created or destroyed.
choices: ['present', 'absent'] choices: [ present, absent ]
default: present default: present
required: false extends_documentation_fragment: influxdb
extends_documentation_fragment: influxdb.documentation
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -44,7 +39,6 @@ EXAMPLES = '''
influxdb_database: influxdb_database:
hostname: "{{influxdb_ip_address}}" hostname: "{{influxdb_ip_address}}"
database_name: "{{influxdb_database_name}}" database_name: "{{influxdb_database_name}}"
state: present
- name: Destroy database - name: Destroy database
influxdb_database: influxdb_database:
@ -58,18 +52,16 @@ EXAMPLES = '''
username: "{{influxdb_username}}" username: "{{influxdb_username}}"
password: "{{influxdb_password}}" password: "{{influxdb_password}}"
database_name: "{{influxdb_database_name}}" database_name: "{{influxdb_database_name}}"
state: present ssl: yes
ssl: False validate_certs: yes
validate_certs: False
''' '''
RETURN = ''' RETURN = '''
#only defaults # only defaults
''' '''
try: try:
import requests.exceptions import requests.exceptions
from influxdb import InfluxDBClient
from influxdb import exceptions from influxdb import exceptions
except ImportError: except ImportError:
pass pass

@ -25,10 +25,6 @@ requirements:
- "influxdb >= 0.9" - "influxdb >= 0.9"
- requests - requests
options: options:
database_name:
description:
- Name of the database where retention policy will be created
required: true
policy_name: policy_name:
description: description:
- Name of the retention policy - Name of the retention policy
@ -45,7 +41,7 @@ options:
description: description:
- Sets the retention policy as default retention policy - Sets the retention policy as default retention policy
required: true required: true
extends_documentation_fragment: influxdb.documentation extends_documentation_fragment: influxdb
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -57,8 +53,8 @@ EXAMPLES = '''
policy_name: test policy_name: test
duration: 1h duration: 1h
replication: 1 replication: 1
ssl: True ssl: yes
validate_certs: True validate_certs: yes
- name: create 1 day retention policy - name: create 1 day retention policy
influxdb_retention_policy: influxdb_retention_policy:
@ -83,19 +79,18 @@ EXAMPLES = '''
policy_name: test policy_name: test
duration: INF duration: INF
replication: 1 replication: 1
ssl: False ssl: no
validate_certs: False validate_certs: no
''' '''
RETURN = ''' RETURN = '''
#only defaults # only defaults
''' '''
import re import re
try: try:
import requests.exceptions import requests.exceptions
from influxdb import InfluxDBClient
from influxdb import exceptions from influxdb import exceptions
except ImportError: except ImportError:
pass pass

@ -23,6 +23,10 @@ options:
description: description:
- The port on which InfluxDB server is listening - The port on which InfluxDB server is listening
default: 8086 default: 8086
database_name:
description:
- Name of the database.
required: true
validate_certs: validate_certs:
description: description:
- If set to C(no), the SSL certificates will not be validated. - If set to C(no), the SSL certificates will not be validated.

Loading…
Cancel
Save