Bug 1576285
| Summary: | atomic uninstall command to remove ipa-server returns error "'NoneType' object has no attribute 'gen_cmd'" | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Nikhil Dehadrai <ndehadra> |
| Component: | atomic | Assignee: | Giuseppe Scrivano <gscrivan> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | atomic-bugs <atomic-bugs> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.5 | CC: | bbaude, ddarrah, dwalsh, ksiddiqu, lsm5, pvoborni, slaznick, weshen |
| Target Milestone: | rc | Keywords: | Extras |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | atomic-1.22.1-4.git1895984.el7_5 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-05-05 14:49:36 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: | |
| Embargoed: | |||
|
Description
Nikhil Dehadrai
2018-05-09 07:18:38 UTC
This PR fixes the issue, I could reproduce it locally: https://github.com/projectatomic/atomic/pull/1235 Atomic host Version:
● ostree://rhel75:rhel-atomic-host/7/x86_64/standard
Version: 7.5.2 (2018-06-09 02:40:55)
Tested the bug with following observations:
Scenario-1.
-------------------
When Container is not stopped and 'atomic uninstall' command is run, the error mentioned is not observed, but the uninstallation isn't clean as it does not create the backup copy at path '/var/lib'. (See output in scenario-2)
[root@ipadocker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d21c518ee411 rhel7/ipa-server "/usr/local/sbin/init" 17 hours ago Up 17 hours ipadocker
[root@ipadocker ~]# docker exec -it ipadocker kinit admin
Password for admin:
[root@ipadocker ~]# docker exec -it ipadocker rpm -q ipa-server
ipa-server-4.5.4-10.el7_5.2.x86_64
[root@ipadocker ~]# atomic uninstall --name ipadocker rhel7/ipa-server
docker stop ipadocker
ipadocker
[root@ipadocker ~]# ls -l /var/lib/ipadocker/
total 20
-rw-r--r--. 1 root root 37 Jun 11 05:56 build-id
-rw-r--r--. 1 root root 41 Jun 18 06:01 docker-run-opts
drwxr-xr-x. 15 root root 4096 Jun 18 06:12 etc
-rw-r--r--. 1 root root 22 Jun 18 06:01 hostname
drwxr-xr-x. 3 root root 59 Jun 18 06:12 root
drwxr-xr-x. 3 root root 19 Jun 11 05:56 usr
drwxr-xr-x. 6 root root 57 Jun 11 05:56 var
-rw-r--r--. 1 root root 4 Jun 18 06:12 volume-version
[root@ipadocker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Scenario-2
-----------------
When Container is stopped and then 'atomic uninstall' command is run, the error mentioned is not observed, but the uninstallation process is complete with the backup copy at path '/var/lib'.
[root@ipadocker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f6badcd01aba rhel7/ipa-server "/usr/local/sbin/init" About a minute ago Up About a minute ipadocker
[root@ipadocker ~]# docker stop ipadocker
ipadocker
[root@ipadocker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@ipadocker ~]# atomic uninstall --name ipadocker rhel7/ipa-server
docker run --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/ipadocker rhel7/ipa-server /bin/uninstall.sh
Moved [/var/lib/ipadocker] aside to [/var/lib/ipadocker.backup.20180619-042114].
[root@ipadocker ~]# ls -l /var/lib/ipadocker.backup.20180619-042114/
total 20
-rw-r--r--. 1 root root 37 Jun 11 05:56 build-id
-rw-r--r--. 1 root root 41 Jun 18 06:01 docker-run-opts
drwxr-xr-x. 15 root root 4096 Jun 18 06:12 etc
-rw-r--r--. 1 root root 22 Jun 18 06:01 hostname
drwxr-xr-x. 3 root root 59 Jun 18 06:12 root
drwxr-xr-x. 3 root root 19 Jun 11 05:56 usr
drwxr-xr-x. 6 root root 57 Jun 11 05:56 var
-rw-r--r--. 1 root root 4 Jun 18 06:12 volume-version
There needs to be consistency in the output / behaviour of the command when run across different scenarios, thus on the basis of above observation changing status to 'ASSIGNED'.
I think the INSTALL label in the image must be fixed for the second scenario to work:
"install": "docker run -ti --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/${NAME} -e NAME=${NAME} -e IMAGE=${IMAGE} ${IMAGE} /bin/install.sh"
If there is an `--rm` in the install label then the container is automatically deleted by Docker on a "stop" thus there is no container left after it is stopped.
nevermind my last comment, it is a bug in atomic that I am looking into.. Could you check if https://github.com/projectatomic/atomic/pull/1242 fixes the issue you have reported? I tested this on atomic host installing latest atomic rpm, this bug seems not fixed, I got the same result as Nikhil had in Comment 7. Versions: [root@atomic-00 cloud-user]# rpm -q atomic atomic-1.22.1-25.git5a342e3.el7.x86_64 root@atomic-00 cloud-user]# atomic host status State: idle; auto updates disabled Deployments: ● ostree://rhel-atomic-host-ostree:rhel-atomic-host/7/x86_64/standard Version: 7.5.2 (2018-06-09 02:40:55) Commit: db4a302e874cdd9cc9517a63133cfdf05e23cb684faae166b444c74cf7c146e8 Unlocked: hotfix ostree://rhel-atomic-host-ostree:rhel-atomic-host/7/x86_64/standard Version: 7.5.2 (2018-06-09 02:40:55) Commit: db4a302e874cdd9cc9517a63133cfdf05e23cb684faae166b444c74cf7c146e8 Basically, I follow the guide[1] to set up the environment: Scenario-1, uninstall without stop the container: ———————————————— 1. pull the latest ipa-server image 2. atomic install --name server-container rhel7/ipa-server publish --hostname $hostname ipa-server-install --ip-address 2001:DB8::1111 3. atomic run --name server-container rhel7/ipa-server 4. On another terminal: 1. docker exec -it server-container kinit admin 2. atomic uninstall --name server-container rhel7/ipa-server Expect: The container can be stopped, and the backup copy should be created. Actual result: If I execute the uninstall command once, the container can be stopped but the backup copy can NOT be created. But if I execute it again, the backup copy can be created: [root@atomic-00 cloud-user]# atomic uninstall --name server-container rhel7/ipa-server docker stop server-container server-container [root@atomic-00 cloud-user]# atomic uninstall --name server-container rhel7/ipa-server docker run --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/server-container rhel7/ipa-server /bin/uninstall.sh Moved [/var/lib/server-container] aside to [/var/lib/server-container.backup.20180912-132434]. Scenario-2, uninstall after stop the container: ——————————————————— Uninstall command can successfully stop the container and create the backup copy. [root@atomic-00 cloud-user]# atomic uninstall --name server-container rhel7/ipa-server docker run --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/server-container rhel7/ipa-server /bin/uninstall.sh Moved [/var/lib/server-container] aside to [/var/lib/server-container.backup.20180912-140031]. [1] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html-single/using_containerized_identity_management_services/index#using-the-ipa-server-container I think the patch didn't get into a build yet. I've tried to reproduce locally but I see the uninstall label is honored with the latest version from git: $ sudo ./atomic uninstall --name ipa-server registry.access.redhat.com/rhel7/ipa-server docker stop ipa-server ipa-server docker run --rm --privileged -v /:/host -e HOST=/host -e DATADIR=/var/lib/ipa-server registry.access.redhat.com/rhel7/ipa-server /bin/uninstall.sh Moved [/var/lib/ipa-server] aside to [/var/lib/ipa-server.backup.20180918-203618]. Unable to find 1650979e359c2398d43a03b8c3b053c2e09a9a75387d51bd6530040fa16a9d3f in the installed containers Would it be possible for you to try with the git version? I'm afraid the patch is still not going into the build? I do the same test for atomic-1.22.1-26.gitb507039.el7.x86_64 as Comment 15, and I have the same result too. It doesn't work. Then I try the git version as Giuseppe recommended, this issue is not seen. Any ideas, Fero? Hi,
the patch says:
diff --git a/Atomic/backends/_docker.py b/Atomic/backends/_docker.py
index 6030078..56d7a80 100644
--- a/Atomic/backends/_docker.py
+++ b/Atomic/backends/_docker.py
@@ -455,7 +455,6 @@ class DockerBackend(Backend):
# have deleted it
if self.has_container(name):
self.delete_container(con_obj.id)
- return
if args.force:
self.delete_containers_by_image(iobject, force=True)
Looking at the code in the built package atomic-1.22.1-26.gitb507039.el7.x86_64.rpm, the little "return" statement is indeed missing and thus the patch is applied and the issue is supposed to be fixed. Maybe it is time to admit that the fix may not fix the supposed-to-be-fixed fixable issue and that we have a problem somewhere.
First idea: Please check the code you are running whether it has the patch applied. It is in /usr/lib/python2.7/site_packages/Atomic/backends/_docker.py
Second idea: The rpm does not work but the git version does, what exactly is the difference between them? Maybe we have a packaging problem?
Yes, the patch is applied. I change a server to test this again. This issue is not seen either for the atomic rpm or github source code. Probably there was some files I messed up on the first machine I had. Sorry about this. I make it verified now. |