Zun

zun exec should return the same exit_code of the command

Bug #1645044 reported by hongbin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zun
Fix Released
Medium
hongbin

Bug Description

$ zun create -i cirros -c "sleep 1000000" -n test
$ zun start test
$ zun --debug exec test -c "kkkkkk"
....
DEBUG (connectionpool:395) "POST /v1/containers/test/execute?command=kkkkkk HTTP/1.1" 200 56
DEBUG (session:286) RESP: [200] Content-Length: 56 Content-Type: application/json; charset=UTF-8 X-Openstack-Request-Id: req-bdb2ff8e-02ba-4fc8-bafb-99e659833d74 Date: Sat, 26 Nov 2016 21:29:36 GMT Connection: keep-alive
RESP BODY: "exec: \"kkkkkk\": executable file not found in $PATH\n"

As showed above, the server return 200 even if the command didn't successfully executed. This is wrong. The server should return a 400 response in that case.

NOTE: the command exit code can be checked in Exec Inspect API: https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/exec-inspect

hongbin (hongbin034)
Changed in zun:
status: New → Triaged
importance: Undecided → Medium
Changed in zun:
assignee: nobody → feng.shengqin@zte.com.cn (feng-shengqin)
Revision history for this message
Pradeep Kumar Singh (pradeep-singh-u) wrote :

@Feng, are you still working on it?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to zun (master)

Fix proposed to branch: master
Review: https://review.openstack.org/428602

Changed in zun:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on zun (master)

Change abandoned by feng.shengqin (<email address hidden>) on branch: master
Review: https://review.openstack.org/428602

hongbin (hongbin034)
summary: - zun exec should fail when the command failed
+ zun exec should return the same exit_code of the command
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to zun (master)

Fix proposed to branch: master
Review: https://review.openstack.org/441719

Changed in zun:
assignee: feng.shengqin@zte.com.cn (feng-shengqin) → hongbin (hongbin034)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to zun (master)

Reviewed: https://review.openstack.org/441719
Committed: https://git.openstack.org/cgit/openstack/zun/commit/?id=ec9e3a6726a52b4e11bf44a950248c104979b803
Submitter: Jenkins
Branch: master

commit ec9e3a6726a52b4e11bf44a950248c104979b803
Author: Hongbin Lu <email address hidden>
Date: Sun Mar 5 16:43:57 2017 -0600

    Return exit_code along with output on exec API

    In before, exec API only returned the command output. It would be
    useful to return the exit_code as well.

    Change-Id: I20cc48da20bdc3784ec8fce4e38a98baf388a0ca
    Partial-Bug: #1645044

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-zunclient 0.2.0

This issue was fixed in the openstack/python-zunclient 0.2.0 release.

hongbin (hongbin034)
Changed in zun:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.