Bug 44286

Summary: apps systemd status broken after docker app is removed (until reboot)
Product: UCS Reporter: Felix Botner <botner>
Component: App CenterAssignee: Felix Botner <botner>
Status: CLOSED FIXED QA Contact: Dirk Wiesenthal <wiesenthal>
Severity: normal    
Priority: P5 CC: wiesenthal
Version: UCS 4.2   
Target Milestone: UCS 4.2-0-errata   
Hardware: Other   
OS: Linux   
What kind of report is it?: Bug Report What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.114 Enterprise Customer affected?:
School Customer affected?: ISV affected?:
Waiting Support: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional):
Max CVSS v3 score:

Description Felix Botner univentionstaff 2017-04-04 15:48:11 CEST
If one installs a docker app at some point the container is started with 

/etc/init.d/docker-app-tecart start

now something bad happens (join fails etc) and the app is removed, but the init script is not called with "STOP", so systemd still thinks docker-app-tecart is started.

-> systemctl status docker-app-tecart 
● docker-app-tecart.service
   Loaded: not-found (Reason: No such file or directory)
   Active: active (exited) since Di 2017-04-04 15:17:34 CEST; 20min ago

-> univention-app info
UCS: 4.2-0 errata0
App Center compatibility: 4
Installed: 4.1/digitec-suitecrm=7.6.3-2 4.1/dudle=1.1.0-1 4.1/etherpad-lite=1.6.0
Upgradable: digitec-suitecrm dudle etherpad-lite

Now the second installation of the app fails because 

/etc/init.d/docker-app-tecart start

is called but systemd does not actually start the container (because it still thinks everything is ok)


Only after a restart i can try again to install the app.
Comment 1 Dirk Wiesenthal univentionstaff 2017-04-23 00:17:18 CEST
Part of the "Join Problems"?
Comment 2 Felix Botner univentionstaff 2017-04-24 17:50:03 CEST
--- python/appcenter-docker/actions/docker_remove.py    (Revision 78743)
+++ python/appcenter-docker/actions/docker_remove.py    (Arbeitskopie)
@@ -37,6 +37,7 @@
 from univention.appcenter.actions import Abort
 from univention.appcenter.actions.remove import Remove
 from univention.appcenter.actions.docker_base import DockerActionMixin
+from univention.appcenter.actions.service import Stop
 
 
 class Remove(Remove, DockerActionMixin):
@@ -72,5 +73,6 @@
                                raise Abort('Could not backup container!')
                docker = self._get_docker(app)
                if docker.container:
+                       Stop.call(app=app)
                        docker.stop()
                        docker.rm()

best solution so far, stop container in _remove_docker_container() so that the systemd status after revert is correct
Comment 3 Felix Botner univentionstaff 2017-04-28 15:22:34 CEST
(In reply to Felix Botner from comment #2)
> --- python/appcenter-docker/actions/docker_remove.py    (Revision 78743)
> +++ python/appcenter-docker/actions/docker_remove.py    (Arbeitskopie)
> @@ -37,6 +37,7 @@
>  from univention.appcenter.actions import Abort
>  from univention.appcenter.actions.remove import Remove
>  from univention.appcenter.actions.docker_base import DockerActionMixin
> +from univention.appcenter.actions.service import Stop
>  
>  
>  class Remove(Remove, DockerActionMixin):
> @@ -72,5 +73,6 @@
>                                 raise Abort('Could not backup container!')
>                 docker = self._get_docker(app)
>                 if docker.container:
> +                       Stop.call(app=app)
>                         docker.stop()
>                         docker.rm()
> 
> best solution so far, stop container in _remove_docker_container() so that
> the systemd status after revert is correct

univention-appcenter r78989
errata4.2-0
Comment 4 Dirk Wiesenthal univentionstaff 2017-05-03 04:27:00 CEST
OK, works
Comment 5 Janek Walkenhorst univentionstaff 2017-05-03 15:16:16 CEST
<http://errata.software-univention.de/ucs/4.2/6.html>