INNER CODE UNIT · Python
check_file
weaveworks/kubediff · kubedifflib/_diff.py:168
def check_file(printer, path, config):
"""Check YAML file 'path' for differences.
:param printer: Where we report differences to.
:param str path: The YAML file to test.
:param dict config: Contains Kubernetes parsing and access configuration.
:return: Number of differences found.
"""
with open(path, 'r') as stream:
expected = yaml.safe_load_all(stream)
differences = 0
for data in expected:
# data can be None, e.g. in cases where the doc ends with a '---'
if not data:
continue
try:
for kube_obj in KubeObject.from_dict(data, config["namespace"]):