Skip to content

Commit

Permalink
Added condition that annotations are not None
Browse files Browse the repository at this point in the history
  • Loading branch information
bo156 committed Jul 6, 2023
1 parent e4edeca commit d43adfa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion checkov/kubernetes/kubernetes_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def build_definitions_context(
relative_resource_path = None
if 'metadata' in resource:
metadata = resource['metadata']
if 'annotations' in metadata and 'config.kubernetes.io/origin' in metadata['annotations']:
if 'annotations' in metadata and metadata['annotations'] is not None\
and 'config.kubernetes.io/origin' in metadata['annotations']:
metadata_path = metadata['annotations']['config.kubernetes.io/origin']
if 'path:' in metadata_path:
relative_resource_path = metadata_path.split('path:')[1].strip()
Expand Down

0 comments on commit d43adfa

Please sign in to comment.