-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add odo project delete -o json #1960
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
59f795d
to
b10cd21
Compare
b10cd21
to
c176f3a
Compare
// If we error out... there's no way to output it (since we disable logging when using -o json) | ||
if err != nil { | ||
fmt.Printf("Unable to unmarshal JSON: %s", err.Error()) | ||
os.Exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exit code for failure to create a project and for failure to generate the machine readable output is same. How would someone who is using the API determine what the exact cause of error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this should never happen, but unfortunately we do hide all non-json related output. What would happen upstream is that VSCode will be unable to marshal the JSON output anyways (it will output "Unable to unmarshal json... from Odo..").
I honestly couldn't think of a better solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I kind of assumed that the message (in this case "Unable to unmarshal JSON
) would be a differentiator, but it still feels a bit skewed. I might sound pedantic here but if we have more such ambiguities w.r.t exit codes, it might come back to bite us since our APIs are going to be crucial for projects like Adapters. Correct me if I'm wrong.
Expect(desired).Should(MatchJSON(actual)) | ||
}) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar tests for project deletion would also be helpful, no? One test that deletes an existing project and another where we try to delete a project that does not exist.
@cdrage Are these CI failure related to your change ? Can you please check |
@amitkrout Most likely. This PR is still WIP / need to rebase again. |
Adds machine readable output for odo create project. To test: ```sh odo create project -o json ```
This PR: - Adds `odo project delete -o json` - Builds upon the global parameter and `odo project create -o json` commits
1489cff
to
319364f
Compare
@cdrage: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Too many changes / rebasing, I've opened up a new PR: #2037 |
This PR:
odo project delete -o json
odo project create -o json
commits