diff --git a/lib/ansible/module_utils/influxdb.py b/lib/ansible/module_utils/influxdb.py index 3278b6469fa..faa6c5b24a5 100644 --- a/lib/ansible/module_utils/influxdb.py +++ b/lib/ansible/module_utils/influxdb.py @@ -60,7 +60,7 @@ class InfluxDb(): 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): diff --git a/lib/ansible/modules/database/influxdb/influxdb_database.py b/lib/ansible/modules/database/influxdb/influxdb_database.py index 8aea65a2a7b..ae6c44b2325 100644 --- a/lib/ansible/modules/database/influxdb/influxdb_database.py +++ b/lib/ansible/modules/database/influxdb/influxdb_database.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# (c) 2016, Kamil Szczygiel +# Copyright: (c) 2016, Kamil Szczygiel # 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 @@ -12,7 +12,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: influxdb_database short_description: Manage InfluxDB databases @@ -29,15 +29,17 @@ options: 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: @@ -60,7 +62,7 @@ EXAMPLES = ''' validate_certs: yes ''' -RETURN = ''' +RETURN = r''' # only defaults ''' diff --git a/lib/ansible/modules/database/influxdb/influxdb_query.py b/lib/ansible/modules/database/influxdb/influxdb_query.py index 407037849fa..4ecc178569d 100644 --- a/lib/ansible/modules/database/influxdb/influxdb_query.py +++ b/lib/ansible/modules/database/influxdb/influxdb_query.py @@ -12,10 +12,10 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', '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 @@ -28,10 +28,12 @@ options: description: - Query to be executed. required: true + type: str database_name: description: - Name of the database. required: true + type: str extends_documentation_fragment: influxdb ''' @@ -55,7 +57,7 @@ EXAMPLES = r''' var: connection.query_results ''' -RETURN = ''' +RETURN = r''' query_results: description: Result from the query returned: success diff --git a/lib/ansible/modules/database/influxdb/influxdb_retention_policy.py b/lib/ansible/modules/database/influxdb/influxdb_retention_policy.py index dba3e28a812..6a2eb697fbe 100644 --- a/lib/ansible/modules/database/influxdb/influxdb_retention_policy.py +++ b/lib/ansible/modules/database/influxdb/influxdb_retention_policy.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# (c) 2016, Kamil Szczygiel +# Copyright: (c) 2016, Kamil Szczygiel # 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 @@ -11,12 +11,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', '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: @@ -28,26 +28,30 @@ options: 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: @@ -86,7 +90,7 @@ EXAMPLES = ''' validate_certs: no ''' -RETURN = ''' +RETURN = r''' # only defaults ''' diff --git a/lib/ansible/modules/database/influxdb/influxdb_user.py b/lib/ansible/modules/database/influxdb/influxdb_user.py index ed0728cbfa0..95884695442 100644 --- a/lib/ansible/modules/database/influxdb/influxdb_user.py +++ b/lib/ansible/modules/database/influxdb/influxdb_user.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# (c) 2017, Vitaliy Zhhuta +# Copyright: (c) 2017, Vitaliy Zhhuta # insipred by Kamil Szczygiel influxdb_database module # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -12,12 +12,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', '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: @@ -28,10 +28,12 @@ options: 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. @@ -41,19 +43,22 @@ options: 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 @@ -95,7 +100,7 @@ EXAMPLES = ''' state: absent ''' -RETURN = ''' +RETURN = r''' #only defaults ''' @@ -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, diff --git a/lib/ansible/modules/database/influxdb/influxdb_write.py b/lib/ansible/modules/database/influxdb/influxdb_write.py index 249c8fe847b..42b33a71d41 100644 --- a/lib/ansible/modules/database/influxdb/influxdb_write.py +++ b/lib/ansible/modules/database/influxdb/influxdb_write.py @@ -15,7 +15,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 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 @@ -28,10 +28,13 @@ options: 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 ''' @@ -81,7 +84,7 @@ class AnsibleInfluxDBWrite(InfluxDb): 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( diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index 672e279dfdd..82e38328e0e 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -2175,16 +2175,6 @@ lib/ansible/modules/commands/command.py validate-modules:undocumented-parameter lib/ansible/modules/commands/command.py validate-modules:nonexistent-parameter-documented lib/ansible/modules/commands/command.py validate-modules:doc-missing-type lib/ansible/modules/commands/expect.py validate-modules:doc-missing-type -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: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-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-type-not-in-doc lib/ansible/modules/database/misc/elasticsearch_plugin.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/kibana_plugin.py validate-modules:parameter-type-not-in-doc