Get full build interface working

This commit is contained in:
Joseph Schorr 2014-02-10 22:43:48 -05:00
parent 7c081f029c
commit ea45c3b77f
7 changed files with 326 additions and 35 deletions

View file

@ -5,6 +5,7 @@ from random import SystemRandom
from loremipsum import get_sentence
from data.buildlogs import BuildLogs
from random import choice
logger = logging.getLogger(__name__)
@ -24,10 +25,22 @@ class TestBuildLogs(BuildLogs):
self.request_counter = 0
self._generate_logs()
def _get_random_command(self):
COMMANDS = ['FROM', 'MAINTAINER', 'RUN', 'CMD', 'EXPOSE', 'ENV', 'ADD',
'ENTRYPOINT', 'VOLUME', 'USER', 'WORKDIR']
return choice(COMMANDS)
def _generate_command(self):
self.last_command += 1
sentence = get_sentence()
command = self._get_random_command()
if command == 'FROM':
sentence = choice(['ubuntu', 'quay.io/devtable/simple', 'quay.io/buynlarge/orgrepo', 'stackbrew/ubuntu:precise'])
return {
'message': 'Step %s : %s' % (self.last_command, get_sentence()),
'message': 'Step %s: %s %s' % (self.last_command, command, sentence),
'is_command': True,
}