Add container to db

This commit is contained in:
CodeKevin
2016-05-07 10:49:38 -04:00
parent a0d7d8abcb
commit a479b3a7aa

View File

@@ -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