projectatomic / atomic

Atomic Run Tool for installing/running/managing container images.
Other
526 stars 139 forks source link

Atomic uninstall fails if container is running. #1221

Closed apollo13 closed 6 years ago

apollo13 commented 6 years ago

Looking at the following code https://github.com/projectatomic/atomic/blob/2fd08606a96e32d90751bd0a703c0b389d306121/Atomic/backends/_docker.py#L453 it is clear that neither atomic nor args are passed in, yet stop_container tries to use it unconditionally: https://github.com/projectatomic/atomic/blob/2fd08606a96e32d90751bd0a703c0b389d306121/Atomic/backends/_docker.py#L305-L317

The full traceback:

Namespace(_class=<class 'Atomic.uninstall.Uninstall'>, args=[], assumeyes=False, debug=True, display=False, force=False, func='uninstall', ignore=False, image='test', name='testinstance', opt1=None, opt2=None, opt3=None, profile=False, storage=None)
'NoneType' object has no attribute 'display'
Traceback (most recent call last):
  File "/bin/atomic", line 185, in <module>
    sys.exit(_func())
  File "/usr/lib/python2.7/site-packages/Atomic/uninstall.py", line 62, in uninstall
    be.uninstall(img_obj, name=self.args.name, atomic=self, ignore=self.args.ignore)
  File "/usr/lib/python2.7/site-packages/Atomic/backends/_docker.py", line 450, in uninstall
    self.stop_container(con_obj)
  File "/usr/lib/python2.7/site-packages/Atomic/backends/_docker.py", line 315, in stop_container
    elif args.display:
AttributeError: 'NoneType' object has no attribute 'display'
giuseppe commented 6 years ago

PR here: https://github.com/projectatomic/atomic/pull/1229

apollo13 commented 6 years ago

@giuseppe Did you test it? because even when args.display is fixed it will still miss atomic: https://github.com/projectatomic/atomic/blob/2fd08606a96e32d90751bd0a703c0b389d306121/Atomic/backends/_docker.py#L301 (for the cases with a stop_arg)

giuseppe commented 6 years ago

what command are you using to trigger that error?

stop_arg is used only with "atomic stop" and in that case atomic should be properly set.

apollo13 commented 6 years ago

Ah okay, I couldn't trigger that error myself; just the one I posted.

giuseppe commented 6 years ago

could you please comment on the PR as well?