def make_release_accepted(obj): for annotations in (obj.model.image.metadata.annotations, obj.model.metadata.annotations, obj.model.tag.annotations): annotations.pop('release.openshift.io/message', None) annotations.pop('release.openshift.io/reason', None) annotations['release.openshift.io/phase'] = 'Accepted' verify_str = annotations['release.openshift.io/verify'] verify = oc.Model(json.loads(verify_str)) verify.upgrade.state = 'Succeeded' if upgrade_url: verify.upgrade.url = upgrade_url verify['upgrade-minor'].state = 'Succeeded' if upgrade_minor_url: verify['upgrade-minor'].url = upgrade_minor_url annotations['release.openshift.io/verify'] = json.dumps( verify._primitive(), indent=None) print(json.dumps(obj.model._primitive(), indent=4)) if confirm: print('Attempting to apply this object.') return True else: print( WARNING + '--confirm was not specified. Run again to apply these changes.' + ENDC) exit(0)
def _get_kubeconfig_model(_kc_model=None): if _kc_model: return _kc_model else: return oc.Model(dict_to_model=get_kubeconfig())