Skip to content

Commit

Permalink
Merge pull request openshift#2243 from spadgett/tags-op
Browse files Browse the repository at this point in the history
Fix error adding first annotation
  • Loading branch information
spadgett authored Apr 19, 2018
2 parents ad18608 + 5f12be1 commit 727af9e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/public/components/modals/tags.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class TagsModal extends PromiseComponent {
// Convert any blank values to null
_.each(tags, t => t[1] = _.isEmpty(t[1]) ? null : t[1]);

const patch = [{path: this.props.path, op: 'replace', value: _.fromPairs(tags)}];
// Make sure to 'add' if the path does not already exist, otherwise the patch request will fail
const op = this.props.tags ? 'replace' : 'add';
const patch = [{path: this.props.path, op, value: _.fromPairs(tags)}];
const promise = k8sPatch(this.props.kind, this.props.resource, patch);
this.handlePromise(promise).then(this.props.close);
}
Expand Down

0 comments on commit 727af9e

Please sign in to comment.