From a479b3a7aa2d646e16dbafef985776f6ba41f876 Mon Sep 17 00:00:00 2001 From: CodeKevin Date: Sat, 7 May 2016 10:49:38 -0400 Subject: [PATCH] Add container to db --- CTFd/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CTFd/utils.py b/CTFd/utils.py index 8bea5bea..d3f165ac 100644 --- a/CTFd/utils.py +++ b/CTFd/utils.py @@ -1,4 +1,4 @@ -from CTFd.models import db, WrongKeys, Pages, Config, Tracking, Teams +from CTFd.models import db, WrongKeys, Pages, Config, Tracking, Teams, Containers from six.moves.urllib.parse import urlparse, urljoin from werkzeug.utils import secure_filename @@ -408,6 +408,10 @@ def create_container(name, buildfile, files): # docker build -f tmpfile.name -t name try: subprocess.call(['docker', 'build', '-f', tmpfile.name, '-t', name]) + container = Containers(name, buildfile) + db.session.add(container) + db.session.commit() + db.session.close() return True except subprocess.CalledProcessError: return False \ No newline at end of file