Skip to content

Commit

Permalink
Helpful errors (cloudera-labs#42)
Browse files Browse the repository at this point in the history
* updated error message for missing tls var
* added error message for when a template cannot be found in groupby
* added Tez gateway verify check
Signed-off-by: William Dyson <wdyson@cloudera.com>
Co-authored-by: William Dyson <wdyson@cloudera.com>
Signed-off-by: William Dyson <wdyson@cloudera.com>
  • Loading branch information
WillDyson authored and William Dyson committed Jul 15, 2022
1 parent 789ffcd commit bdea64e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
9 changes: 7 additions & 2 deletions roles/deployment/groupby/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@
key: "{{ 'host_template_' ~ host_template if host_template is defined else 'no_template' }}"

- name: Find the correct host template
set_fact:
host_template_content: "{{ _pre_template_cluster | json_query(query) | first }}"
block:
- fail:
msg: "Unable to host template {{ host_template }} in the cluster definition"
when: content | length == 0
- set_fact:
host_template_content: "{{ content | first }}"
vars:
query: "clusters[].host_templates[].\"{{ host_template }}\""
content: "{{ _pre_template_cluster | json_query(query) }}"
when: host_template is defined

- name: Group by service
Expand Down
4 changes: 3 additions & 1 deletion roles/verify/definition/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
success_msg: "TLS is configured on a set of nodes"
fail_msg: >-
TLS certificate distribution is not configured in the cluster inventory
file (set manual_tls_cert_distribution if this is intentional)
file.
If this is intential, set manual_tls_cert_distribution=true.
Otherwise, set tls=true for each host requiring a certificate.
when: has_tls and not (manual_tls_cert_distribution | default(false))
- name: Ensure that TLS distribution is not configured in the inventory
assert:
Expand Down
10 changes: 10 additions & 0 deletions roles/verify/parcels_and_roles/tasks/check_template_roles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
| map('regex_replace','/.+','')
| difference(role_mappings[template.service] | list)
}}
- name: Ensure the host template service roles are valid
assert:
that: "{{ invalid_roles | length == 0 }}"
Expand All @@ -31,3 +32,12 @@
fail_msg: >-
Unknown role(s) {{ invalid_roles }} for service '{{ template.service }}'
defined in host template '{{ host_template.name }}'.
- name: Ensure the Tez gateway has been deployed
assert:
that: "{{ 'GATEWAY' in (host_template.mappings['TEZ'] | default({})) }}"
success_msg: The Tez gateway has been included as required
fail_msg: The Tez gateway should be colocated with Hive On Tez roles
when:
- template.service == 'HIVE_ON_TEZ'
- "'HIVESERVER2' in template.roles or 'GATEWAY' in template.roles"

0 comments on commit bdea64e

Please sign in to comment.