def __init__(self, application_name): session = Session() self.application = session.query(Application). \ filter(Application.name == application_name).first() if not self.application: log.error("No application found") raise SkylerException("No application found") self.deployment = None self.params = {'run_script': 'runapp.sh', 'setup_script': 'setupapp.sh', 'base_image': 'skyler-python26'} self.configurations = {}
def start_deploy(self): session = Session() d = Deployment(application_id=self.application.id, state=DEPLOYMENT_STATE_STARTED) session.add(d) session.commit() self.deployment = d session.flush() log.info('deployment {} <{}> #{}'.format(self.application.name, self.application.source, d.id)) self.configurations = self.inspect_env() self.pack_env() b_dir = self.build_templates('web') self.build_image(b_dir, 'web') d.state = DEPLOYMENT_STATE_BUILT_OK session.add(d) session.commit()