Skip to content

Commit 10b66e6

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

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:
@@ -165,7 +166,7 @@
165166
- name: Prepare for CDP DW experiences
166167
when: run__include_dw
167168
block:
168-
- name: Construct CDP DW Data catalog configurations
169+
- name: Construct CDP DW Data Catalog configurations
169170
ansible.builtin.set_fact:
170171
run__dw_dbc_configs: "{{ run__dw_dbc_configs | default([]) | union([config]) }}"
171172
vars:
@@ -179,7 +180,7 @@
179180
loop_var: __dw_config
180181
index_var: __dw_config_index
181182

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

0 commit comments

Comments
 (0)