def updateContainer(): input = request.get_json(silent=True) validation = doValidate(input) if validation: return response.reply(message=validation.message, status=403) try: client = LXCContainer(input) return response.reply(client.update()) except ValueError as ex: return response.reply(message=ex.__str__(), status=403)
def createContainer(): input = request.get_json(silent=True) validation = doValidate(input) if validation: return response.reply(message=validation.message, status=403) input = [input] if not isinstance(input, list) else input try: result = [] for container in input: client = LXCContainer(container) result.append(client.create()) return response.reply(result) except ValueError as ex: return response.reply(message=ex.__str__(), status=403)