From 438df9b2868fe9432cc5b90cbac5b9d1bf180d12 Mon Sep 17 00:00:00 2001 From: aleksvagachev Date: Sun, 22 Sep 2024 21:11:50 +0300 Subject: [PATCH] Deleted get_functions --- plugins/modules/clickhouse_info.py | 38 ------------------- .../targets/clickhouse_info/tasks/initial.yml | 20 ---------- 2 files changed, 58 deletions(-) diff --git a/plugins/modules/clickhouse_info.py b/plugins/modules/clickhouse_info.py index 81c0c7e..f8be573 100644 --- a/plugins/modules/clickhouse_info.py +++ b/plugins/modules/clickhouse_info.py @@ -145,15 +145,6 @@ type: dict sample: { "readonly": "..." } version_added: '0.4.0' -functions: - description: - - The content of the system.functions table with function names as keys. - - Works only for clickhouse-server versions >= 22. - - Does not output functions on the 'System' origin. - returned: success - type: dict - sample: { "test_function": "..." } - version_added: '0.4.0' storage_policies: description: - The content of the system.storage_policies table with storage_policies names as keys. @@ -635,34 +626,6 @@ def get_settings_profile_elements(module, client): return settings_profile_elements -def get_functions(module, client): - """Get functions. - - Returns a dictionary with function names as keys. - """ - srv_version = get_server_version(module, client) - function_info = {} - if srv_version['year'] >= 22: - query = ("SELECT name, is_aggregate, case_insensitive, alias_to, " - "create_query, origin FROM system.functions " - "WHERE origin != 'System'") - result = execute_query(module, client, query) - - if result == PRIV_ERR_CODE: - return {PRIV_ERR_CODE: "Not enough privileges"} - - for row in result: - function_info[row[0]] = { - "is_aggregate": str(row[1]), - "case_insensitive": row[2], - "alias_to": row[3], - "create_query": row[4], - "origin": row[5], - } - - return function_info - - def get_storage_policies(module, client): """Get storage_policies. @@ -763,7 +726,6 @@ def main(): 'quotas': get_quotas, 'settings_profiles': get_settings_profiles, 'settings_profile_elements': get_settings_profile_elements, - 'functions': get_functions, 'storage_policies': get_storage_policies, 'grants': get_all_grants, } diff --git a/tests/integration/targets/clickhouse_info/tasks/initial.yml b/tests/integration/targets/clickhouse_info/tasks/initial.yml index f424c1d..520d6ca 100644 --- a/tests/integration/targets/clickhouse_info/tasks/initial.yml +++ b/tests/integration/targets/clickhouse_info/tasks/initial.yml @@ -97,23 +97,3 @@ - result is not changed - result["version"] != {} - result["driver"]["version"] != {} - -- name: Check function - when: result['version']['year'] >= 22 - block: - - name: Create function - community.clickhouse.clickhouse_client: - execute: "CREATE FUNCTION linear_equation AS (x, k, b) -> k*x + b" - - - name: Get info - register: result_func - community.clickhouse.clickhouse_info: - login_host: localhost - limit: - - functions - - - name: Check result - ansible.builtin.assert: - that: - - result_func is not changed - - result_func["functions"] != {}