Make check_hieradata not fail on empty values of ceph::profile::params::osds

Previously the check would stop the deployment if the hieradata was set
even if valued to empty hash or string. This patch changes the check
so that it will pass if the hieradata is found but set to empty values.

Closes-Bug: 1893066
Change-Id: I183731c81fe5ea40f32f82c48f7053eae6eaed1e
This commit is contained in:
Giulio Fidente 2020-08-26 17:05:16 +02:00
parent fb05b48550
commit 84755aaba8
1 changed files with 2 additions and 2 deletions

View File

@ -34,11 +34,11 @@ workflows:
collect_puppet_hieradata:
on-success: check_hieradata
publish:
hieradata: <% env().get('role_merged_configs', {}).values().select($.keys()).flatten().select(regex('^ceph::profile::params::osds$').search($)).where($ != null).toSet() %>
hieradata: <% env().get('role_merged_configs', {}).values().where($ != null).where($.get('ceph::profile::params::osds')).first({}).get('ceph::profile::params::osds', {}) %>
check_hieradata:
on-success:
- set_blacklisted_ips: <% not bool($.hieradata) %>
- fail(msg=<% 'Ceph deployment stopped, puppet-ceph hieradata found. Convert it into ceph-ansible variables. {0}'.format($.hieradata) %>): <% bool($.hieradata) %>
- fail(msg=<% 'Ceph deployment stopped, puppet-ceph hieradata found for ceph::profile::params::osds. Convert it to ceph-ansible variables. {0}'.format($.hieradata) %>): <% bool($.hieradata) %>
set_blacklisted_ips:
publish:
blacklisted_ips: <% env().get('blacklisted_ip_addresses', []) %>