From: Eric Leblond Date: Thu, 22 Oct 2015 19:20:54 +0000 (+0200) Subject: prscript: add rm command X-Git-Tag: suricata-3.0RC1~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b85901a6b494ec608b31ab6267f0e9989afa61e4;p=thirdparty%2Fsuricata.git prscript: add rm command This command removes the container and the image allowing to free the disk space allocated during the creation. --- diff --git a/qa/prscript.py b/qa/prscript.py index f67d94cc44..02dd0ad948 100755 --- a/qa/prscript.py +++ b/qa/prscript.py @@ -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"