generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f58ead3
commit 1913a68
Showing
4 changed files
with
121 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# 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 | ||
|
||
__metaclass__ = type | ||
|
||
|
||
class ModuleDocFragment(object): | ||
DOCUMENTATION = r''' | ||
options: | ||
login_host: | ||
description: | ||
- The same as the C(Client(host='...')) argument. | ||
type: str | ||
default: 'localhost' | ||
login_port: | ||
description: | ||
- The same as the C(Client(port='...')) argument. | ||
- If not passed, relies on the driver's default argument value. | ||
type: int | ||
login_db: | ||
description: | ||
- The same as the C(Client(database='...')) argument. | ||
- If not passed, relies on the driver's default argument value. | ||
type: str | ||
login_user: | ||
description: | ||
- The same as the C(Client(user='...')) argument. | ||
- If not passed, relies on the driver's default argument value. | ||
- Be sure your the user has permissions to read the system tables | ||
listed in the RETURN section. | ||
type: str | ||
login_password: | ||
description: | ||
- The same as the C(Client(password='...')) argument. | ||
- If not passed, relies on the driver's default argument value. | ||
type: str | ||
client_kwargs: | ||
description: | ||
- Any additional keyword arguments you want to pass | ||
to the Client interface when instantiating its object. | ||
type: dict | ||
default: {} | ||
requirements: [ 'clickhouse-driver' ] | ||
notes: | ||
- See the clickhouse-driver | ||
L(documentation,https://clickhouse-driver.readthedocs.io/en/latest) | ||
for more information about the driver interface. | ||
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# This code is part of Ansible, but is an independent component. | ||
# This particular file snippet, and this file snippet only, is BSD licensed. | ||
# Modules you write using this snippet, which is embedded dynamically by Ansible | ||
# still belong to the author of the module, and may assign their own license | ||
# to the complete work. | ||
# | ||
# Simplified BSD License (see simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
__metaclass__ = type | ||
|
||
from ansible.module_utils.basic import missing_required_lib | ||
|
||
|
||
def client_common_argument_spec(): | ||
""" | ||
Return a dictionary with connection options. | ||
The options are commonly used by many modules. | ||
""" | ||
return dict( | ||
login_host=dict(type='str', default='localhost'), | ||
login_port=dict(type='int', default=None), | ||
login_db=dict(type='str', default=None), | ||
login_user=dict(type='str', default=None), | ||
login_password=dict(type='str', default=None, no_log=True), | ||
client_kwargs=dict(type='dict', default={}), | ||
) | ||
|
||
|
||
def check_driver(module, has_db_driver): | ||
"""Checks if the driver is present. | ||
Informs user if no driver and fails. | ||
""" | ||
if not has_db_driver: | ||
module.fail_json(msg=missing_required_lib('clickhouse_driver')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters