Skip to content

Commit 1c25d5d

Browse files
committed
Check DW Virtual Warehouse tags
Signed-off-by: Webster Mudge <wmudge@cloudera.com>
1 parent d811a6c commit 1c25d5d

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

roles/runtime/tasks/initialize_base.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
ansible.builtin.set_fact:
5353
run__cdp_datalake_version: "{{ __cdp_datalake_version_info.versions[0].runtimeVersion | trim }}"
5454

55+
# TODO Discover version if upstream is not present
5556
- name: Set fact for CDP Datalake version by assignment
5657
when: plat__cdp_datalake_version is defined
5758
ansible.builtin.set_fact:
@@ -168,7 +169,7 @@
168169
- name: Prepare for CDP DW experiences
169170
when: run__include_dw
170171
block:
171-
- name: Construct CDP DW Data catalog configurations
172+
- name: Construct CDP DW Data Catalog configurations
172173
ansible.builtin.set_fact:
173174
run__dw_dbc_configs: "{{ run__dw_dbc_configs | default([]) | union([config]) }}"
174175
vars:
@@ -182,7 +183,7 @@
182183
loop_var: __dw_config
183184
index_var: __dw_config_index
184185

185-
- name: Construct CDP DW Virtual warehouse configurations
186+
- name: Construct CDP DW Virtual Warehouse configurations
186187
ansible.builtin.set_fact:
187188
run__dw_vw_configs: "{{ run__dw_vw_configs | default([]) | union([config]) }}"
188189
vars:
@@ -198,4 +199,18 @@
198199
loop_control:
199200
loop_var: __dw_config
200201
index_var: __dw_dbc_index
201-
label: "{{ config.name }}"
202+
label: "{{ config.name }}"
203+
204+
- name: Check CDP DW Virtual Warehouse tags
205+
ansible.builtin.assert:
206+
that:
207+
- __dw_vw_config.tags | dict2items | rejectattr('value', 'regex', '[^-_a-zA-Z0-9.=:+@]+') | list
208+
fail_msg:
209+
- "A tag in Data Warehouse, '{{ __dw_vw_config.name }}', does not meet requirements;"
210+
- "current tags: {{ __dw_vw_config.tags}}."
211+
- "Allowed characters in tags are letters, numbers and the following characters: _.:/=+-@"
212+
quiet: yes
213+
loop_control:
214+
loop_var: __dw_vw_config
215+
label: "{{ __dw_vw_config.name }}"
216+
loop: "{{ run__dw_vw_configs }}"

0 commit comments

Comments
 (0)