]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
prscript: add rm command
authorEric Leblond <eric@regit.org>
Thu, 22 Oct 2015 19:20:54 +0000 (21:20 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 17 Nov 2015 13:07:35 +0000 (14:07 +0100)
This command removes the container and the image allowing to
free the disk space allocated during the creation.

qa/prscript.py

index f67d94cc44a29fde99406f7d1885807a701c58b5..02dd0ad948c0cb110aaae51380fbfc718954f000 100755 (executable)
@@ -72,6 +72,7 @@ parser.add_argument('-d', '--docker', action='store_const', const=True, help='us
 parser.add_argument('-C', '--create', action='store_const', const=True, help='create docker container' + docker_deps, default=False)
 parser.add_argument('-s', '--start', action='store_const', const=True, help='start docker container' + docker_deps, default=False)
 parser.add_argument('-S', '--stop', action='store_const', const=True, help='stop docker container' + docker_deps, default=False)
+parser.add_argument('-R', '--rm', action='store_const', const=True, help='remove docker container and image' + docker_deps, default=False)
 parser.add_argument('branch', metavar='branch', help='github branch to build', nargs='?')
 args = parser.parse_args()
 username = args.username
@@ -246,6 +247,20 @@ def StopContainer():
     cli.stop('suri-buildbot')
     sys.exit(0)
 
+def RmContainer():
+    cli = Client()
+    try:
+        cli.remove_container('suri-buildbot')
+    except:
+        print "Unable to remove suri-buildbot container"
+        pass
+    try:
+        cli.remove_image('regit/suri-buildbot:latest')
+    except:
+        print "Unable to remove suri-buildbot images"
+        pass
+    sys.exit(0)
+
 if GOT_DOCKER:
     if args.create:
         CreateContainer()
@@ -253,6 +268,8 @@ if GOT_DOCKER:
         StartContainer()
     if args.stop:
         StopContainer()
+    if args.rm:
+        RmContainer()
 
 if not args.branch:
     print "You need to specify a branch for this mode"