Skip to content

Commit bac4fe3

Browse files
Add and update CDW modules (#29)
* Add 'dw_database_catalog' and 'dw_database_catalog_info' modules * Add 'dw_virtual_warehouse' and 'dw_virtual_warehouse_info' modules * Update 'dw_cluster' and 'dw_cluster_info' modules documentation * Normalize top-level key for return values from 'clusters' to 'cluster' for 'dw_cluster' * Add 'private_load_balancer' option to 'dw_cluster' module * Replace 'cdpy.dw.gather_clusters()' call with 'cdpy.dw.list_clusters()' call in 'dw_cluster_info' module to reduce scope of returned values (will require explicit 'dw_*_info' calls to achieve prior returned values) * Add 'violations' as discrete key within returned SDK errors * Add check for verbosity or debug to SDK warnings handler * Update parameter naming, aliases, and requirements across all 'dw_*' modules Signed-off-by: Saravanan Raju <saravanan.footloose@gmail.com> Signed-off-by: Webster Mudge <wmudge@cloudera.com> Co-authored-by: Saravanan Raju <saravanan.footloose@gmail.com>
1 parent 2bbea9b commit bac4fe3

File tree

9 files changed

+1347
-171
lines changed

9 files changed

+1347
-171
lines changed

docsrc/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ cloudera.cloud Ansible Collection
1919
df_info <df_info>
2020
dw_cluster <dw_cluster>
2121
dw_cluster_info <dw_cluster_info>
22+
dw_database_catalog <dw_database_catalog>
23+
dw_database_catalog_info <dw_database_catalog_info>
24+
dw_virtual_warehouse <dw_virtual_warehouse>
25+
dw_virtual_warehouse_info <dw_virtual_warehouse_info>
2226
env <env>
2327
env_auth <env_auth>
2428
env_auth_info <env_auth_info>

plugins/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ modules employ the underlying SDK contained within the `cdpy` Python package.
2020
| [df_info](./modules/df_info.py) | Gather information about CDP DataFlow services |
2121
| [dw_cluster](./modules/dw_cluster.py) | Create, manage, and destroy CDP Data Warehouse experiences |
2222
| [dw_cluster_info](./modules/dw_cluster_info.py) | Gather information about CDP Data Warehouse experiences |
23+
| [dw_database_catalog](./modules/dw_database_catalog.py) | Create, manage, and destroy CDP Data Warehouse Data Catalogs |
24+
| [dw_database_catalog_info](./modules/dw_database_catalog_info.py) | Gather information about CDP Data Warehouse Data Catalogs |
25+
| [dw_virtual_warehouse](./modules/dw_virtual_warehouse.py) | Create, manage, and destroy CDP Data Warehouse Virtual Warehouses |
26+
| [dw_virtual_warehouse_info](./modules/dw_virtual_warehouse_info.py) | Gather information about CDP Data Warehouse Virtual Warehouses |
2327
| [env](./modules/env.py) | Create, manage, and destroy CDP Environments |
2428
| [env_auth](./modules/env_auth.py) | Set authentication details for CDP Environments |
2529
| [env_auth_info](./modules/env_auth_info.py) | Gather information about CDP Environment authentication details |

plugins/module_utils/cdp_common.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def process_debug(cls, f):
4141
def _impl(self, *args, **kwargs):
4242
result = f(self, *args, **kwargs)
4343
if self.debug:
44-
self.log_out = self.cdpy.get_log()
44+
self.log_out = self.cdpy.sdk.get_log()
4545
self.log_lines.append(self.log_out.splitlines())
4646
return result
4747

@@ -73,11 +73,12 @@ def _get_param(self, param, default=None):
7373

7474
def _cdp_module_throw_error(self, error: 'CdpError'):
7575
"""Error handler for CDPy SDK"""
76-
self.module.fail_json(msg=str(error.message), error=str(error.__dict__))
76+
self.module.fail_json(msg=str(error.message), error=str(error.__dict__), violations=error.violations)
7777

7878
def _cdp_module_throw_warning(self, warning: 'CdpWarning'):
7979
"""Warning handler for CDPy SDK"""
80-
self.module.warn(warning.message)
80+
if self.module._debug or self.module._verbosity >= 2:
81+
self.module.warn(warning.message)
8182

8283
@staticmethod
8384
def argument_spec(**spec):

0 commit comments

Comments
 (0)