mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-14 05:22:08 +00:00
lint validation
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -92,7 +92,7 @@ jobs:
|
|||||||
# The 3.3.0 release of molecule introduced a breaking change. See
|
# The 3.3.0 release of molecule introduced a breaking change. See
|
||||||
# https://github.com/ansible-community/molecule/issues/3083
|
# https://github.com/ansible-community/molecule/issues/3083
|
||||||
- name: Install molecule and openshift dependencies
|
- name: Install molecule and openshift dependencies
|
||||||
run: pip install ansible "molecule<3.3.0" yamllint openshift flake8 jsonpatch
|
run: pip install ansible "molecule<3.3.0" yamllint openshift flake8 jsonpatch jmespath
|
||||||
|
|
||||||
# The latest release doesn't work with Molecule currently.
|
# The latest release doesn't work with Molecule currently.
|
||||||
# See: https://github.com/ansible-community/molecule/issues/2757
|
# See: https://github.com/ansible-community/molecule/issues/2757
|
||||||
|
|||||||
@@ -374,9 +374,9 @@
|
|||||||
namespace: "{{ wait_namespace }}"
|
namespace: "{{ wait_namespace }}"
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: crashing-container
|
- name: crashing-container
|
||||||
image: busybox
|
image: busybox
|
||||||
command: ['/dummy/dummy-shell', '-c', 'sleep 2000']
|
command: ['/dummy/dummy-shell', '-c', 'sleep 2000']
|
||||||
wait: yes
|
wait: yes
|
||||||
wait_timeout: 10
|
wait_timeout: 10
|
||||||
wait_property:
|
wait_property:
|
||||||
@@ -390,7 +390,7 @@
|
|||||||
- crash_pod is failed
|
- crash_pod is failed
|
||||||
- crash_pod.changed
|
- crash_pod.changed
|
||||||
- '"Resource creation timed out" in crash_pod.msg'
|
- '"Resource creation timed out" in crash_pod.msg'
|
||||||
|
|
||||||
- name: add a valid pod and wait until container is running
|
- name: add a valid pod and wait until container is running
|
||||||
k8s:
|
k8s:
|
||||||
definition:
|
definition:
|
||||||
@@ -401,9 +401,9 @@
|
|||||||
namespace: "{{ wait_namespace }}"
|
namespace: "{{ wait_namespace }}"
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: crashing-container
|
- name: crashing-container
|
||||||
image: busybox
|
image: busybox
|
||||||
command: ['/bin/sh', '-c', 'sleep 10000']
|
command: ['/bin/sh', '-c', 'sleep 10000']
|
||||||
wait: yes
|
wait: yes
|
||||||
wait_timeout: 10
|
wait_timeout: 10
|
||||||
wait_property:
|
wait_property:
|
||||||
@@ -428,16 +428,16 @@
|
|||||||
namespace: "{{ wait_namespace }}"
|
namespace: "{{ wait_namespace }}"
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: redis-container
|
- name: redis-container
|
||||||
image: redis
|
image: redis
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: test
|
- name: test
|
||||||
mountPath: "/etc/test"
|
mountPath: "/etc/test"
|
||||||
readOnly: true
|
readOnly: true
|
||||||
volumes:
|
volumes:
|
||||||
- name: test
|
- name: test
|
||||||
configMap:
|
configMap:
|
||||||
name: redis-config
|
name: redis-config
|
||||||
wait: yes
|
wait: yes
|
||||||
wait_timeout: 10
|
wait_timeout: 10
|
||||||
wait_property:
|
wait_property:
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import traceback
|
|
||||||
from ansible.module_utils.basic import missing_required_lib
|
from ansible.module_utils.basic import missing_required_lib
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
@@ -60,8 +59,6 @@ def match_json_property(module, data, expr, value=None):
|
|||||||
jmespath.functions.REVERSE_TYPES_MAP['string'] = jmespath.functions.REVERSE_TYPES_MAP['string'] + ('AnsibleUnicode', 'AnsibleUnsafeText', )
|
jmespath.functions.REVERSE_TYPES_MAP['string'] = jmespath.functions.REVERSE_TYPES_MAP['string'] + ('AnsibleUnicode', 'AnsibleUnsafeText', )
|
||||||
try:
|
try:
|
||||||
content = jmespath.search(expr, data)
|
content = jmespath.search(expr, data)
|
||||||
with open("/tmp/play.cont", "w") as f:
|
|
||||||
f.write("{}".format(content))
|
|
||||||
if content is None or content == []:
|
if content is None or content == []:
|
||||||
return False
|
return False
|
||||||
if value is None or _match_value(content, value):
|
if value is None or _match_value(content, value):
|
||||||
@@ -69,4 +66,4 @@ def match_json_property(module, data, expr, value=None):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
_raise_or_fail(err, msg="JMESPathError failed to extract from JSON document using expr: {}".format(expr))
|
_raise_or_fail(err, msg="JMESPathError failed to extract from JSON document using expr: {0}".format(expr))
|
||||||
|
|||||||
Reference in New Issue
Block a user