)]}'
{"roles/tripleo-container-stop/tasks/container_stop.yaml":[{"author":{"_account_id":6926,"name":"Bogdan Dobrelya","email":"bdobreli@redhat.com","username":"bogdando"},"change_message_id":"aced842bcf8f1b6efbcb36d4f3e91bc02e183c3b","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"- name: Make sure the container is stopped even if container_cli do not match"},{"line_number":3,"context_line":"  shell: |"},{"line_number":4,"context_line":"    if {{ container_cli }} ps | grep {{ container }}; then"},{"line_number":5,"context_line":"      {{ container_cli }} stop {{ container }}"},{"line_number":6,"context_line":"    # handle situation when container_cli is podman but"},{"line_number":7,"context_line":"    # the containers are still under docker"}],"source_content_type":"text/x-yaml","patch_set":1,"id":"9fb8cfa7_2eac3d34","line":4,"range":{"start_line":4,"start_character":7,"end_line":4,"end_character":29},"updated":"2019-07-03 15:29:12.000000000","message":"I\u0027m skeptical on the podman ps performance. Perhaps we could just stop it and ignore errors.","commit_id":"56768de2d8496d384336ba305d90a62aaecce2f9"},{"author":{"_account_id":20778,"name":"Damien Ciabrini","email":"dciabrin@redhat.com","username":"dciabrin"},"change_message_id":"b2feb5912183f03a8e36ade32716c88203478dc9","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"- name: Make sure the container is stopped even if container_cli do not match"},{"line_number":3,"context_line":"  shell: |"},{"line_number":4,"context_line":"    if {{ container_cli }} ps | grep {{ container }}; then"},{"line_number":5,"context_line":"      {{ container_cli }} stop {{ container }}"},{"line_number":6,"context_line":"    # handle situation when container_cli is podman but"},{"line_number":7,"context_line":"    # the containers are still under docker"}],"source_content_type":"text/x-yaml","patch_set":3,"id":"7faddb67_6694a3e9","line":4,"updated":"2019-07-04 08:00:53.000000000","message":"I have the same feeling as Bogdan. A ps command forces podman to scan all the known containers, which is slow and might be slower under IO load.\n\nYou could do a unconditional \"podman stop {{ container }}\" and maybe filter unwanted errors. If a container doesn\u0027t exist you\u0027d get 125 in $?.\n\nSince podman 1.0.2, you could also check for container existence by trying a \"podman exec {{ container }} /bin/true\" and looking for the result. That should return 0 if the container exists and is running, or 126 if the container exists but is stopped.\n\n(I tend to think the unconditional stop is simpler)","commit_id":"2d3ab49ffb0b8315815cfe4177668691d8748dc9"},{"author":{"_account_id":8042,"name":"Jiří Stránský","email":"jistr@redhat.com","username":"jistr"},"change_message_id":"7fbd17a4472a757a60751cd8f85724e721b055ea","unresolved":false,"context_lines":[{"line_number":13,"context_line":"      echo \"$stop_cont - Command was successful\""},{"line_number":14,"context_line":"    else"},{"line_number":15,"context_line":"      echo \"$stop_cont - Command failed trying with docker\""},{"line_number":16,"context_line":"      docker stop {{ container }}"},{"line_number":17,"context_line":"    fi"}],"source_content_type":"text/x-yaml","patch_set":4,"id":"7faddb67_5a985769","line":16,"range":{"start_line":16,"start_character":6,"end_line":16,"end_character":33},"updated":"2019-07-04 13:00:38.000000000","message":"This will return nonzero if the container doesn\u0027t exist, which will make the `if` block return nonzero, and the `shell` task will fail. Also the `docker` command might not exist at all, which would also fail the task. What about:\n\n    set -eu\n    if type {{container_cli}} \u0026\u003e /dev/null \u0026\u0026 {{container_cli}} exec {{ container }} /bin/true; then\n        {{container_cli}} stop {{container}}\n    elif type docker \u0026\u003e /dev/null \u0026\u0026 docker exec {{ container }} /bin/true; then\n        docker stop {{container}}\n    fi\n\nI think this should attempt to stop the container only if it exists and is running, and in case the stopping fails, the task will fail too. That\u0027s probably what we want?","commit_id":"7486b7249802d470f2f47a5f310028cd1ac31a87"},{"author":{"_account_id":20775,"name":"Carlos Camacho","email":"ccamacho@redhat.com","username":"ccamacho"},"change_message_id":"119e665813701954c61c699b8aeb6d06bb3d9488","unresolved":false,"context_lines":[{"line_number":13,"context_line":"      echo \"$stop_cont - Command was successful\""},{"line_number":14,"context_line":"    else"},{"line_number":15,"context_line":"      echo \"$stop_cont - Command failed trying with docker\""},{"line_number":16,"context_line":"      docker stop {{ container }}"},{"line_number":17,"context_line":"    fi"}],"source_content_type":"text/x-yaml","patch_set":4,"id":"7faddb67_1d4ad926","line":16,"range":{"start_line":16,"start_character":6,"end_line":16,"end_character":33},"in_reply_to":"7faddb67_5a985769","updated":"2019-07-04 13:31:21.000000000","message":"Yeahp you are right there, this seems to work fine. Updated.","commit_id":"7486b7249802d470f2f47a5f310028cd1ac31a87"}]}
