mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-07-29 19:04:39 +00:00
helm: return correct information in check mode (#281)
Fixes: #280 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
2
changelogs/fragments/280_helm_status.yml
Normal file
2
changelogs/fragments/280_helm_status.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- helm - return values in check mode when release is not present (https://github.com/ansible-collections/community.kubernetes/issues/280).
|
||||||
@@ -27,6 +27,24 @@
|
|||||||
- install_fail is failed
|
- install_fail is failed
|
||||||
- "'Error: create: failed to create: namespaces \"' + helm_namespace + '\" not found' in install_fail.stderr"
|
- "'Error: create: failed to create: namespaces \"' + helm_namespace + '\" not found' in install_fail.stderr"
|
||||||
|
|
||||||
|
- name: "Install {{ chart_test }} from {{ source }} in check mode"
|
||||||
|
helm:
|
||||||
|
binary_path: "{{ helm_binary }}"
|
||||||
|
name: test
|
||||||
|
chart_ref: "{{ chart_source }}"
|
||||||
|
chart_version: "{{ chart_source_version | default(omit) }}"
|
||||||
|
namespace: "{{ helm_namespace }}"
|
||||||
|
create_namespace: true
|
||||||
|
register: install_check_mode
|
||||||
|
check_mode: true
|
||||||
|
|
||||||
|
- name: "Assert that {{ chart_test }} chart is installed from {{ source }} in check mode"
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- install_check_mode is changed
|
||||||
|
- install_check_mode.status is defined
|
||||||
|
- install_check_mode.status.values is defined
|
||||||
|
|
||||||
- name: "Install {{ chart_test }} from {{ source }}"
|
- name: "Install {{ chart_test }} from {{ source }}"
|
||||||
helm:
|
helm:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
|
|||||||
@@ -537,10 +537,15 @@ def main():
|
|||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
check_status = {'values': {
|
check_status = {
|
||||||
"current": release_status['values'],
|
'values': {
|
||||||
"declared": release_values
|
"current": {},
|
||||||
}}
|
"declared": {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if release_status:
|
||||||
|
check_status['values']['current'] = release_status['values']
|
||||||
|
check_status['values']['declared'] = release_status
|
||||||
|
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
changed=changed,
|
changed=changed,
|
||||||
|
|||||||
Reference in New Issue
Block a user