-
Notifications
You must be signed in to change notification settings - Fork 243
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
odo url list -o json
will not return empty list
#1978
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 |
odo url list -o json
will not return empty list
@@ -67,6 +69,23 @@ func (o *URLListOptions) Run() (err error) { | |||
localUrls := o.localConfigInfo.GetUrl() | |||
|
|||
if log.IsJSON() { | |||
if len(localUrls) != 0 { | |||
for _, u := range localUrls { |
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.
might be a good idea to extract this out into a function, this is becoming a bit less readable in my opinion
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.
👍
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.
maybe a more descriptive variable name than u
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.
This whole logic should be probably part of url.List
The Url
struct should have the Status
field, similar to how it is done for Component
to indicate if the Url is pushed or not.
@surajnarwade is there an open issue that this PR is addressing? Functionality LGTM 👍 $ odo url list -o json
{"kind":"List","apiVersion":"odo.openshift.io/v1alpha1","metadata":{},"items":null}
$ odo url list
Found the following URLs for component nodejs-nodejs-ex-kyvs in application app:
NAME IN CONFIG URL PORT
nodejs-nodejs-ex-kyvs-8080 Present <not created on cluster> 8080
To create URLs on the OpenShift Cluster, please use `odo push`
nodejs-ex - master! $ cd $GOPATH/src/github.com/openshift/odo
# After building odo from this PR
$ odo url list -o json
{"kind":"List","apiVersion":"odo.openshift.io/v1alpha1","metadata":{},"items":[{"kind":"url","apiVersion":"odo.openshift.io/v1alpha1","metadata":{"name":"nodejs-nodejs-ex-kyvs-8080","creationTimestamp":null},"spec":{}}]}
$ odo url list
Found the following URLs for component nodejs-nodejs-ex-kyvs in application app:
NAME IN CONFIG URL PORT
nodejs-nodejs-ex-kyvs-8080 Present <not created on cluster> 8080
To create URLs on the OpenShift Cluster, please use `odo push
# After doing odo push
$ odo url list
Found the following URLs for component nodejs-nodejs-ex-kyvs in application app:
NAME IN CONFIG URL PORT
nodejs-nodejs-ex-kyvs-8080 Present http://nodejs-nodejs-ex-kyvs-8080-app-myproject.192.168.42.48.nip.io 8080
$ odo url list -o json | jq .
{
"kind": "List",
"apiVersion": "odo.openshift.io/v1alpha1",
"metadata": {},
"items": [
{
"kind": "url",
"apiVersion": "odo.openshift.io/v1alpha1",
"metadata": {
"name": "nodejs-nodejs-ex-kyvs-8080",
"creationTimestamp": null
},
"spec": {
"host": "nodejs-nodejs-ex-kyvs-8080-app-myproject.192.168.42.48.nip.io",
"protocol": "http",
"port": 8080
}
}
]
}
|
@@ -67,6 +69,23 @@ func (o *URLListOptions) Run() (err error) { | |||
localUrls := o.localConfigInfo.GetUrl() | |||
|
|||
if log.IsJSON() { | |||
if len(localUrls) != 0 { | |||
for _, u := range localUrls { | |||
p, err := url.Exists(o.Client, u.Name, o.Component(), o.Application) |
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.
a more descriptive variable name than p
@surajnarwade Please add PR description or at least link to the issue? |
@dharmit , I have updated the description with respective issue 😄 |
`odo url list -o json` will not return empty list fixes redhat-developer#1893 <!-- Please do Link issues here. --> * Create the URL using `odo url create` * Check `odo url list -o json`, it should give output
4963d6a
to
8f921ab
Compare
replaced by #2034 /close |
@kadel: Closed this PR. In response to this:
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. |
What is the purpose of this change? What does it change?
odo url list -o json
will not return empty listWas the change discussed in an issue?
fixes #1893
How to test changes?
odo url create
odo url list -o json
, it should give output