def update_binding_secret(context): openshift = Openshift() secret_yaml = yaml.full_load(context.text) secret_yaml["metadata"]["name"] = context.sb_secret output = openshift.apply(yaml.dump(secret_yaml), context.namespace.name) result = re.search(rf'.*{context.sb_secret}.*(created|unchanged|configured)', output) assert result is not None, f"Unable to apply YAML for binding secret '{context.sb_secret}': {output}"
def apply_yaml(context): openshift = Openshift() metadata = yaml.full_load(context.text)["metadata"] metadata_name = metadata["name"] if "namespace" in metadata: ns = metadata["namespace"] else: if "namespace" in context: ns = context.namespace.name else: ns = None output = openshift.apply(context.text, ns) result = re.search(rf'.*{metadata_name}.*(created|unchanged|configured)', output) assert result is not None, f"Unable to apply YAML for CR '{metadata_name}': {output}"
def apply_yaml(context, user=None): openshift = Openshift() resource = substitute_scenario_id(context, context.text) metadata = yaml.full_load(resource)["metadata"] metadata_name = metadata["name"] if "namespace" in metadata: ns = metadata["namespace"] else: if "namespace" in context: ns = context.namespace.name else: ns = None output = openshift.apply(resource, ns, user) result = re.search(rf'.*{metadata_name}.*(created|unchanged|configured)', output) assert result is not None, f"Unable to apply YAML for CR '{metadata_name}': {output}" return metadata