Esempio n. 1
0
    def post(self, request, name, stage):
        log.info("Update Cluster Capacity with data {}".format(request.body))
        try:
            settings = json.loads(request.body)
            cluster_name = '{}-{}'.format(name, stage)
            log.info("Update cluster {0} with {1}".format(cluster_name, settings))
            minSize = int(settings['minsize'])
            maxSize = int(settings['maxsize'])
            clusters_helper.update_cluster_capacity(request, cluster_name, minSize, maxSize)
        except Exception as e:
            log.info("Post to cluster capacity view has an error {}", e)
            return HttpResponse(e, status=500, content_type="application/json")

        return HttpResponse(json.dumps(settings), content_type="application/json")
Esempio n. 2
0
    def post(self, request, name, stage):
        log.info("Update Cluster Capacity with data {}".format(request.body))
        try:
            settings = json.loads(request.body)
            cluster_name = '{}-{}'.format(name, stage)
            log.info("Update cluster {0} with {1}".format(
                cluster_name, settings))
            minSize = int(settings['minsize'])
            maxSize = int(settings['maxsize'])
            clusters_helper.update_cluster_capacity(
                request, cluster_name, minSize, maxSize)
        except Exception as e:
            log.info("Post to cluster capacity view has an error {}", e)
            return HttpResponse(e, status=500, content_type="application/json")

        return HttpResponse(json.dumps(settings), content_type="application/json")