Skip to content
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

No message is generated for component create command with -o json flag #2309

Closed
amitkrout opened this issue Oct 22, 2019 · 9 comments · Fixed by #2532
Closed

No message is generated for component create command with -o json flag #2309

amitkrout opened this issue Oct 22, 2019 · 9 comments · Fixed by #2532
Assignees
Labels
area/json-output Issues or PRs related to JSON output (machine readable output) kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)).
Projects

Comments

@amitkrout
Copy link
Contributor

amitkrout commented Oct 22, 2019

[kind/bug]

What versions of software are you using?

  • Operating System: All
  • Output of odo version: Master

How did you run odo exactly?

$ odo component create python -o json
$ 
// i am expecting json format output or an error message if it is not supported
$ odo component create python -o json
{
    "kind": "Error",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "creationTimestamp": null
    },
    "message": "this directory already contains a component"
}
// looks good

Actual behavior

No display of output message

Expected behavior

Json format output or an error message if it is not supported

Any logs, error output, etc?

@amitkrout
Copy link
Contributor Author

/kind bug

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 22, 2019
@girishramnani
Copy link
Contributor

successfully reproduced.
would a message like be shown the user?

{
    "kind": "Success",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "creationTimestamp": null
    },
    "message": "Please use `odo push` command to create the component with source deployed"
}

i.e. the final message produced by the cli when -o json is not provided?

@kadel
Copy link
Member

kadel commented Oct 22, 2019

successfully reproduced.
would a message like be shown the user?

{
    "kind": "Success",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "creationTimestamp": null
    },
    "message": "Please use `odo push` command to create the component with source deployed"
}

i.e. the final message produced by the cli when -o json is not provided?

Nope. If the operation is successful it should return what was created. So, in this case, the output should be the same as running odo component describe -o json right after odo component create

@cdrage
Copy link
Member

cdrage commented Nov 1, 2019

@kadel

For odo component describe -o json to work, you actually have to push the component.

See below:

▶ odo component describe -o json
{
    "kind": "Error",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "creationTimestamp": null
    },
    "message": "component nodejs-nodejs-ex-geah not pushed to the OpenShift cluster, use `odo push` to deploy the component"
}

So in theory, we're unable to actually output everything to the user after using odo create -o json since odo describe uses this function:

https://github.com/openshift/odo/blob/master/pkg/odo/cli/component/describe.go#L72

Which requires ports to be available to get it..

Which I was hoping to simply drop into the create.go file.

This opens up another issue, we can't actually use odo describe without the component being pushed, should we remove the GetPorts() all-together?

https://github.com/openshift/odo/blob/master/pkg/odo/cli/component/describe.go#L72

@kadel kadel added this to For consideration in Sprint 175 via automation Nov 4, 2019
@kadel kadel removed this from For consideration in Sprint 175 Nov 25, 2019
@amitkrout
Copy link
Contributor Author

/priority medium

@openshift-ci-robot openshift-ci-robot added the priority/Medium Nice to have issue. Getting it done before priority changes would be great. label Dec 2, 2019
@kadel
Copy link
Member

kadel commented Dec 9, 2019

For odo component describe -o json to work, you actually have to push the component.

Not anymore. This PR #2399 implemented odo describe even for not pushed components.

/kind feature
/remove-kind bug
/priority high

This is not a bug, but something that was not yet implemented.

@openshift-ci-robot openshift-ci-robot added kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). and removed kind/bug Categorizes issue or PR as related to a bug. labels Dec 9, 2019
@kadel kadel added the area/json-output Issues or PRs related to JSON output (machine readable output) label Dec 9, 2019
@girishramnani girishramnani removed the priority/Medium Nice to have issue. Getting it done before priority changes would be great. label Jan 7, 2020
@girishramnani girishramnani added this to For concideration in Sprint 178 via automation Jan 7, 2020
@girishramnani girishramnani moved this from For concideration to To do in Sprint 178 Jan 8, 2020
@girishramnani girishramnani added this to For consideration in Sprint 179 via automation Jan 27, 2020
@girishramnani girishramnani removed this from To do in Sprint 178 Jan 27, 2020
@girishramnani girishramnani moved this from For consideration to To do in Sprint 179 Jan 27, 2020
@mohammedzee1000
Copy link
Contributor

❯ odo push -o json
{
    "kind": "Component",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "name": "nodejs-nodejs-ex-2-qehq",
        "namespace": "myproject",
        "creationTimestamp": null
    },
    "spec": {
        "app": "app",
        "type": "nodejs",
        "source": "file://./",
        "env": [
            {
                "name": "DEBUG_PORT",
                "value": "5858"
            }
        ]
    },
    "status": {
        "state": "Pushed"
    }
}


@mohammedzee1000 mohammedzee1000 moved this from To do to In progress in Sprint 179 Jan 27, 2020
@girishramnani girishramnani moved this from In progress to For review in Sprint 179 Jan 27, 2020
@mohammedzee1000
Copy link
Contributor

Ok corrected:

❯ odo create -o json nodejs
{
    "kind": "Component",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "name": "nodejs-nodejs-ex-2-quxc",
        "namespace": "myproject",
        "creationTimestamp": null
    },
    "spec": {
        "app": "app",
        "type": "nodejs",
        "source": "file://./",
        "ports": [
            "8080/TCP"
        ]
    },
    "status": {
        "state": "Not Pushed"
    }
}

❯ odo create python --now -o json
{
    "kind": "Component",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "name": "python-python-bveb",
        "namespace": "myproject",
        "creationTimestamp": null
    },
    "spec": {
        "app": "app",
        "type": "python",
        "source": "file://./",
        "env": [
            {
                "name": "DEBUG_PORT",
                "value": "5858"
            }
        ]
    },
    "status": {
        "state": "Pushed"
    }
}


@kadel kadel added this to For consideration in Sprint 181 via automation Mar 10, 2020
@kadel kadel moved this from For consideration to In progress in Sprint 181 Mar 10, 2020
@kadel kadel removed this from For review in Sprint 179 Mar 10, 2020
@girishramnani girishramnani removed this from In progress in Sprint 181 Mar 30, 2020
@girishramnani girishramnani added this to For consideration in Sprint 182 via automation Mar 30, 2020
@girishramnani girishramnani moved this from For consideration to In progress in Sprint 182 Mar 30, 2020
@mohammedzee1000
Copy link
Contributor

#2532

@mohammedzee1000 mohammedzee1000 moved this from In progress to For review in Sprint 182 Apr 1, 2020
Sprint 182 automation moved this from For review to Done Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/json-output Issues or PRs related to JSON output (machine readable output) kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)).
Projects
No open projects
Sprint 182
  
Done
Development

Successfully merging a pull request may close this issue.

6 participants