Bug 1030777

Summary: Delete app when userid is missing will not remove the gear dir
Product: OpenShift Online Reporter: Liang Xia <lxia>
Component: ContainersAssignee: Jhon Honce <jhonce>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: jhadvig, xtian
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-30 00:50:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Liang Xia 2013-11-15 06:15:54 UTC
Description of problem:
Delete app when userid is missing will not remove the gear dir

Version-Release number of selected component (if applicable):
devenv_4038

How reproducible:
always

Steps to Reproduce:
1.Create an app.
2.SSH into the instance.
3.Remove the user of the gear in /etc/passwd on node.
4.Delete the app.
5.Check the gear dir in /var/lib/openshift

Actual results:
App delete successfully, but the gear dir and the link to this directory are left behind.

Expected results:
The gear dir and link should be removed.

Additional info:
https://bugzilla.redhat.com/show_bug.cgi?id=918764

Comment 1 Jakub Hadvig 2013-11-20 18:13:21 UTC
I don't think that this is a bug, because if user at some point corrupts the system it is his fault. Its the same like if you delete some record from DB and then wonder where it is. 
Was looking on the platform-trace.log on the node and find that the problem might be that this two problems might be related.


...
November 20 11:48:37 INFO oo_spawn running userdel --remove -f "528ce61667bcd186be000032": {:unsetenv_others=>false, :close_others=>true, :in=>"/dev/null", :out=>#<IO:fd 13>, :err=>#<IO:fd 11>}
November 20 11:48:37 INFO oo_spawn running setquota --always-resolve -u 528ce61667bcd186be000032 0 0 0 0 -a /var: {:unsetenv_others=>false, :close_others=>true, :in=>"/dev/null", :out=>#<IO:fd 13>, :err=>#<IO:fd 11>}
November 20 11:48:37 INFO oo_spawn buffer(8/) setquota:
November 20 11:48:37 INFO oo_spawn buffer(8/) user 528ce61667bcd186be000032 does not exist.

So what I think is that I will let this bug opened and will fix the error handling that the user doesnt exists.

Comment 2 Liang Xia 2014-01-14 07:02:09 UTC
"User does not exist" is gone from platform.log/platform-trace.log

Based on comment #1, move to verified.

Comment 3 Liang Xia 2014-01-14 07:13:59 UTC
(In reply to Liang Xia from comment #2)
> "User does not exist" is gone from platform.log/platform-trace.log
> 
> Based on comment #1, move to verified.

Build is devenv_4217.

Comment 4 openshift-github-bot 2014-01-14 18:55:50 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/d5ca57a638ee7e3ede7850f890d12b5f94b83620
Bug 1030777 - Remove gear dir even if gear not in passwd file

Comment 6 Liang Xia 2014-01-15 02:35:11 UTC
Verified on devenv_4223, the issue has been fixed.

1.Check whether new codes are there or not.
# grep remove_app_symlinks /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.19.8/lib/openshift-origin-node/model/application_container.rb
          remove_app_symlinks(@container_dir)
          remove_app_symlinks(@container_dir)
      def remove_app_symlinks(container_dir)

2.Create apps and check gears are created.
# ls /var/lib/openshift/
52d5eba01e82d3e7fb000007  915738339324026173784064       jenkins-lxia   phps-lxia
52d5ebf81e82d3e7fb000028  915738339324026173784064-lxia  last_access.log

3.Remove the users of the gears in /etc/passwd on node.

4.Delete the apps.
# rhc app delete phps --confirm
Deleting application 'phps' ... deleted
# rhc app delete jenkins --confirm 
Deleting application 'jenkins' ... deleted

5.Check the gear dir in /var/lib/openshift/
# ls /var/lib/openshift/
last_access.log