Skip to content

Commit

Permalink
influxdb: Fix documentation (ansible#67807)
Browse files Browse the repository at this point in the history
Signed-off-by: Abhijeet Kasurde <[email protected]>
  • Loading branch information
Akasurde authored Feb 27, 2020
1 parent 0882170 commit ed306c7
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 44 deletions.
2 changes: 1 addition & 1 deletion lib/ansible/module_utils/influxdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def influxdb_argument_spec():
retries=dict(type='int', default=3),
proxies=dict(type='dict', default={}),
use_udp=dict(type='bool', default=False),
udp_port=dict(type='int'),
udp_port=dict(type='int', default=4444),
)

def connect_to_influxdb(self):
Expand Down
12 changes: 7 additions & 5 deletions lib/ansible/modules/database/influxdb/influxdb_database.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python

# (c) 2016, Kamil Szczygiel <kamil.szczygiel () intel.com>
# Copyright: (c) 2016, Kamil Szczygiel <kamil.szczygiel () intel.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
Expand All @@ -12,7 +12,7 @@
'supported_by': 'community'}


DOCUMENTATION = '''
DOCUMENTATION = r'''
---
module: influxdb_database
short_description: Manage InfluxDB databases
Expand All @@ -29,15 +29,17 @@
description:
- Name of the database.
required: true
type: str
state:
description:
- Determines if the database should be created or destroyed.
choices: [ present, absent ]
choices: [ absent, present ]
default: present
type: str
extends_documentation_fragment: influxdb
'''

EXAMPLES = '''
EXAMPLES = r'''
# Example influxdb_database command from Ansible Playbooks
- name: Create database
influxdb_database:
Expand All @@ -60,7 +62,7 @@
validate_certs: yes
'''

RETURN = '''
RETURN = r'''
# only defaults
'''

Expand Down
8 changes: 5 additions & 3 deletions lib/ansible/modules/database/influxdb/influxdb_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
'supported_by': 'community'}


DOCUMENTATION = '''
DOCUMENTATION = r'''
---
module: influxdb_query
short_description: Query data points from InfluxDB.
short_description: Query data points from InfluxDB
description:
- Query data points from InfluxDB.
version_added: 2.5
Expand All @@ -28,10 +28,12 @@
description:
- Query to be executed.
required: true
type: str
database_name:
description:
- Name of the database.
required: true
type: str
extends_documentation_fragment: influxdb
'''

Expand All @@ -55,7 +57,7 @@
var: connection.query_results
'''

RETURN = '''
RETURN = r'''
query_results:
description: Result from the query
returned: success
Expand Down
24 changes: 14 additions & 10 deletions lib/ansible/modules/database/influxdb/influxdb_retention_policy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python

# (c) 2016, Kamil Szczygiel <kamil.szczygiel () intel.com>
# Copyright: (c) 2016, Kamil Szczygiel <kamil.szczygiel () intel.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
Expand All @@ -11,12 +11,12 @@
'supported_by': 'community'}


DOCUMENTATION = '''
DOCUMENTATION = r'''
---
module: influxdb_retention_policy
short_description: Manage InfluxDB retention policies
description:
- Manage InfluxDB retention policies
- Manage InfluxDB retention policies.
version_added: 2.1
author: "Kamil Szczygiel (@kamsz)"
requirements:
Expand All @@ -28,26 +28,30 @@
description:
- Name of the database.
required: true
type: str
policy_name:
description:
- Name of the retention policy
- Name of the retention policy.
required: true
type: str
duration:
description:
- Determines how long InfluxDB should keep the data
- Determines how long InfluxDB should keep the data.
required: true
type: str
replication:
description:
- Determines how many independent copies of each point are stored in the cluster
- Determines how many independent copies of each point are stored in the cluster.
required: true
type: int
default:
description:
- Sets the retention policy as default retention policy
required: true
- Sets the retention policy as default retention policy.
type: bool
extends_documentation_fragment: influxdb
'''

EXAMPLES = '''
EXAMPLES = r'''
# Example influxdb_retention_policy command from Ansible Playbooks
- name: create 1 hour retention policy
influxdb_retention_policy:
Expand Down Expand Up @@ -86,7 +90,7 @@
validate_certs: no
'''

RETURN = '''
RETURN = r'''
# only defaults
'''

Expand Down
25 changes: 15 additions & 10 deletions lib/ansible/modules/database/influxdb/influxdb_user.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python

# (c) 2017, Vitaliy Zhhuta <zhhuta () gmail.com>
# Copyright: (c) 2017, Vitaliy Zhhuta <zhhuta () gmail.com>
# insipred by Kamil Szczygiel <kamil.szczygiel () intel.com> influxdb_database module
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

Expand All @@ -12,12 +12,12 @@
'status': ['preview'],
'supported_by': 'community'}

DOCUMENTATION = '''
DOCUMENTATION = r'''
---
module: influxdb_user
short_description: Manage InfluxDB users
description:
- Manage InfluxDB users
- Manage InfluxDB users.
version_added: 2.5
author: "Vitaliy Zhhuta (@zhhuta)"
requirements:
Expand All @@ -28,10 +28,12 @@
description:
- Name of the user.
required: True
type: str
user_password:
description:
- Password to be set for the user.
required: false
type: str
admin:
description:
- Whether the user should be in the admin role or not.
Expand All @@ -41,19 +43,22 @@
state:
description:
- State of the user.
choices: [ present, absent ]
choices: [ absent, present ]
default: present
type: str
grants:
description:
- Privileges to grant to this user. Takes a list of dicts containing the
"database" and "privilege" keys.
- Privileges to grant to this user.
- Takes a list of dicts containing the "database" and "privilege" keys.
- If this argument is not provided, the current grants will be left alone.
If an empty list is provided, all grants for the user will be removed.
- If an empty list is provided, all grants for the user will be removed.
version_added: 2.8
type: list
elements: dict
extends_documentation_fragment: influxdb
'''

EXAMPLES = '''
EXAMPLES = r'''
- name: Create a user on localhost using default login credentials
influxdb_user:
user_name: john
Expand Down Expand Up @@ -95,7 +100,7 @@
state: absent
'''

RETURN = '''
RETURN = r'''
#only defaults
'''

Expand Down Expand Up @@ -204,7 +209,7 @@ def main():
user_name=dict(required=True, type='str'),
user_password=dict(required=False, type='str', no_log=True),
admin=dict(default='False', type='bool'),
grants=dict(type='list')
grants=dict(type='list', elements='dict'),
)
module = AnsibleModule(
argument_spec=argument_spec,
Expand Down
7 changes: 5 additions & 2 deletions lib/ansible/modules/database/influxdb/influxdb_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
DOCUMENTATION = r'''
---
module: influxdb_write
short_description: Write data points into InfluxDB.
short_description: Write data points into InfluxDB
description:
- Write data points into InfluxDB.
version_added: 2.5
Expand All @@ -28,10 +28,13 @@
description:
- Data points as dict to write into the database.
required: true
type: list
elements: dict
database_name:
description:
- Name of the database.
required: true
type: str
extends_documentation_fragment: influxdb
'''

Expand Down Expand Up @@ -80,7 +83,7 @@ def write_data_point(self, data_points):
def main():
argument_spec = InfluxDb.influxdb_argument_spec()
argument_spec.update(
data_points=dict(required=True, type='list'),
data_points=dict(required=True, type='list', elements='dict'),
database_name=dict(required=True, type='str'),
)
module = AnsibleModule(
Expand Down
13 changes: 0 additions & 13 deletions test/sanity/ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2789,19 +2789,6 @@ lib/ansible/modules/commands/expect.py validate-modules:doc-missing-type
lib/ansible/modules/crypto/acme/acme_account_info.py validate-modules:return-syntax-error
lib/ansible/modules/crypto/acme/acme_certificate.py validate-modules:doc-elements-mismatch
lib/ansible/modules/database/aerospike/aerospike_migrations.py yamllint:unparsable-with-libyaml
lib/ansible/modules/database/influxdb/influxdb_database.py validate-modules:doc-default-does-not-match-spec
lib/ansible/modules/database/influxdb/influxdb_database.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/database/influxdb/influxdb_query.py validate-modules:doc-default-does-not-match-spec
lib/ansible/modules/database/influxdb/influxdb_query.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/database/influxdb/influxdb_retention_policy.py validate-modules:doc-default-does-not-match-spec
lib/ansible/modules/database/influxdb/influxdb_retention_policy.py validate-modules:doc-required-mismatch
lib/ansible/modules/database/influxdb/influxdb_retention_policy.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/database/influxdb/influxdb_user.py validate-modules:doc-default-does-not-match-spec
lib/ansible/modules/database/influxdb/influxdb_user.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/influxdb/influxdb_user.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/database/influxdb/influxdb_write.py validate-modules:doc-default-does-not-match-spec
lib/ansible/modules/database/influxdb/influxdb_write.py validate-modules:parameter-list-no-elements
lib/ansible/modules/database/influxdb/influxdb_write.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/database/misc/elasticsearch_plugin.py validate-modules:doc-missing-type
lib/ansible/modules/database/misc/elasticsearch_plugin.py validate-modules:invalid-ansiblemodule-schema
lib/ansible/modules/database/misc/elasticsearch_plugin.py validate-modules:parameter-type-not-in-doc
Expand Down

0 comments on commit ed306c7

Please sign in to comment.