Skip to content

Commit

Permalink
Handle empty resource annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
willthames authored and fabianvf committed Mar 11, 2019
1 parent f85ec01 commit 544dec2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openshift/dynamic/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
LAST_APPLIED_CONFIG_ANNOTATION = 'kubectl.kubernetes.io/last-applied-configuration'

def apply(resource, definition):
if not 'annotations' in definition['metadata']:
definition['metadata']['annotations'] = dict()
definition['metadata']['annotations'][LAST_APPLIED_CONFIG_ANNOTATION] = definition
try:
actual = resource.get(name=definition['metadata']['name'], namespace=definition['metadata']['namespace']).to_dict()
Expand Down

0 comments on commit 544dec2

Please sign in to comment.