Переглянути джерело

Update rm command to always remove one-off containers.

Signed-off-by: Joffrey F <[email protected]>
Joffrey F 9 роки тому
батько
коміт
844b7d463f
2 змінених файлів з 5 додано та 9 видалено
  1. 5 7
      compose/cli/main.py
  2. 0 2
      tests/acceptance/cli_test.py

+ 5 - 7
compose/cli/main.py

@@ -532,17 +532,15 @@ class TopLevelCommand(object):
         Options:
             -f, --force   Don't ask to confirm removal
             -v            Remove any anonymous volumes attached to containers
-            -a, --all     Also remove one-off containers created by
+            -a, --all     Obsolete. Also remove one-off containers created by
                           docker-compose run
         """
         if options.get('--all'):
-            one_off = OneOffFilter.include
-        else:
             log.warn(
-                'Not including one-off containers created by `docker-compose run`.\n'
-                'To include them, use `docker-compose rm --all`.\n'
-                'This will be the default behavior in the next version of Compose.\n')
-            one_off = OneOffFilter.exclude
+                '--all flag is obsolete. This is now the default behavior '
+                'of `docker-compose rm`'
+            )
+        one_off = OneOffFilter.include
 
         all_containers = self.project.containers(
             service_names=options['SERVICE'], stopped=True, one_off=one_off

+ 0 - 2
tests/acceptance/cli_test.py

@@ -1192,8 +1192,6 @@ class CLITestCase(DockerClientTestCase):
         self.assertEqual(len(service.containers(stopped=True, one_off=OneOffFilter.only)), 1)
         self.dispatch(['rm', '-f'], None)
         self.assertEqual(len(service.containers(stopped=True)), 0)
-        self.assertEqual(len(service.containers(stopped=True, one_off=OneOffFilter.only)), 1)
-        self.dispatch(['rm', '-f', '-a'], None)
         self.assertEqual(len(service.containers(stopped=True, one_off=OneOffFilter.only)), 0)
 
         service.create_container(one_off=False)