mirror of
https://github.com/openshift/community.okd.git
synced 2026-07-25 00:44:32 +00:00
openshift_process fails with template does not contains message (#87)
* fix unexpected value * changelog * Update pod-template.yaml * Update openshift_process.py * Update openshift_process.py * Update molecule/default/tasks/openshift_process.yml Co-authored-by: Fabian von Feilitzsch <fabian@fabianism.us> * Update pod-template.yaml Co-authored-by: Fabian von Feilitzsch <fabian@fabianism.us>
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- openshift_process - fix module execution when template does not include a message (https://github.com/ansible-collections/community.okd/pull/87).
|
||||||
23
molecule/default/files/pod-template.yaml
Normal file
23
molecule/default/files/pod-template.yaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
kind: Template
|
||||||
|
apiVersion: template.openshift.io/v1
|
||||||
|
metadata:
|
||||||
|
name: pod-template
|
||||||
|
objects:
|
||||||
|
- apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: "Pod-${{ NAME }}"
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- args:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- while true; do echo $(date); sleep 15; done
|
||||||
|
image: python:3.7-alpine
|
||||||
|
imagePullPolicy: Always
|
||||||
|
name: python
|
||||||
|
parameters:
|
||||||
|
- name: NAME
|
||||||
|
description: trailing name of the pod
|
||||||
|
required: true
|
||||||
@@ -162,3 +162,22 @@
|
|||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that: result is not changed
|
that: result is not changed
|
||||||
|
|
||||||
|
# Processing template without message
|
||||||
|
- name: create template with file {{ files_dir }}/pod-template.yaml
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
namespace: process-test
|
||||||
|
src: "{{ files_dir }}/pod-template.yaml"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Process pod template
|
||||||
|
community.okd.openshift_process:
|
||||||
|
name: pod-template
|
||||||
|
namespace: process-test
|
||||||
|
state: rendered
|
||||||
|
parameters:
|
||||||
|
NAME: ansible
|
||||||
|
register: rendered_template
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that: rendered_template.message == ""
|
||||||
|
|||||||
@@ -330,8 +330,9 @@ class OpenShiftProcess(K8sAnsibleMixin):
|
|||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self.module.fail_json(msg="Server failed to render the Template: {0}".format(to_native(exc)),
|
self.module.fail_json(msg="Server failed to render the Template: {0}".format(to_native(exc)),
|
||||||
error='', status='', reason='')
|
error='', status='', reason='')
|
||||||
|
result['message'] = ""
|
||||||
result['message'] = response['message']
|
if "message" in response:
|
||||||
|
result['message'] = response['message']
|
||||||
result['resources'] = response['objects']
|
result['resources'] = response['objects']
|
||||||
|
|
||||||
if state != 'rendered':
|
if state != 'rendered':
|
||||||
|
|||||||
Reference in New Issue
Block a user