Description of problem: oo-broker's clean-up code is unreliable. If I hit ctrl-c at the wrong time, oo-broker does not clean up the container or cidfile. How reproducible: Racy. Steps to Reproduce: 1. Start a devenv. 2. Run oo-broker with some command (e.g., an echo or sleep command). 3. Hit ctrl-c at just the wrong time (hitting it a lot, or holding it down, increases the probability of this happening). 4. Run `ls /tmp/openshift`. 5. If there is a file in /tmp/openshift/, run `docker inspect $(< /tmp/openshift/oo-broker-cid_*)`. Actual results: At Step 4, the cidfile is still in /tmp/openshift/. At Step 5, `docker inspect` reveals that the container is still running. Expected results: The cidfile and container should both be gone.
PR: https://github.com/openshift/li/pull/2764
Commit pushed to master at https://github.com/openshift/li https://github.com/openshift/li/commit/4229cd1222b35789b63feccdf82e355a7443d43a oo-broker: improve clean-up code Use trap EXIT in oo-broker and oo-broker-modify in order to clean up the cidfile and container more reliably. This commit fixes bug 1124022.
Verified on devenv_5027 there was not a file in /tmp/openshift/ [root@ip-10-63-162-136 ~]# oo-broker oo-admin-ctl-user -l fli --setmaxgears 20 from /var/www/openshift/broker/config/environment.rb:14:in `<top (required)>' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /usr/sbin/oo-admin-ctl-user:645:in `<main>' ^C[root@ip-10-63-162-136 ~]ls /tmp/openshift/ [root@ip-10-63-162-136 ~]#