2019-05-27 18:17:42 +02:00
|
|
|
- python_requirements_info:
|
2018-11-16 13:44:59 +01:00
|
|
|
dependencies:
|
|
|
|
- openshift==0.6.0
|
|
|
|
- kubernetes==6.0.0
|
|
|
|
|
|
|
|
# append_hash
|
|
|
|
- name: use append_hash with ConfigMap
|
|
|
|
k8s:
|
|
|
|
definition:
|
|
|
|
metadata:
|
|
|
|
name: config-map-test
|
|
|
|
namespace: "{{ playbook_namespace }}"
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
data:
|
|
|
|
hello: world
|
|
|
|
append_hash: yes
|
|
|
|
ignore_errors: yes
|
|
|
|
register: k8s_append_hash
|
|
|
|
|
|
|
|
- name: assert that append_hash fails gracefully
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- k8s_append_hash is failed
|
2019-02-06 18:39:17 +01:00
|
|
|
- "'Failed to import the required Python library (openshift >= 0.7.2)' in k8s_append_hash.msg"
|
|
|
|
- "'. This is required for append_hash.' in k8s_append_hash.msg"
|
2018-11-16 13:44:59 +01:00
|
|
|
|
|
|
|
# validate
|
|
|
|
- name: attempt to use validate with older openshift
|
|
|
|
k8s:
|
|
|
|
definition:
|
|
|
|
metadata:
|
|
|
|
name: config-map-test
|
|
|
|
namespace: "{{ playbook_namespace }}"
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
data:
|
|
|
|
hello: world
|
|
|
|
validate:
|
|
|
|
fail_on_error: yes
|
|
|
|
ignore_errors: yes
|
|
|
|
register: k8s_validate
|
|
|
|
|
|
|
|
- name: assert that validate fails gracefully
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- k8s_validate is failed
|
2018-11-22 09:14:43 +01:00
|
|
|
- "k8s_validate.msg == 'openshift >= 0.8.0 is required for validate'"
|
2019-07-08 22:47:41 +02:00
|
|
|
|
|
|
|
# apply
|
|
|
|
- name: attempt to use apply with older openshift
|
|
|
|
k8s:
|
|
|
|
definition:
|
|
|
|
metadata:
|
|
|
|
name: config-map-test
|
|
|
|
namespace: "{{ playbook_namespace }}"
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
data:
|
|
|
|
hello: world
|
|
|
|
apply: yes
|
|
|
|
ignore_errors: yes
|
|
|
|
register: k8s_apply
|
|
|
|
|
|
|
|
- name: assert that apply fails gracefully
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- k8s_apply is failed
|
|
|
|
- "k8s_apply.msg.startswith('Failed to import the required Python library (openshift >= 0.9.0)')"
|