Beispiel #1
0
    def get(self, layer_id, action):
        action = action.lower()

        if action == "dockerfile":
            layer_tree = _get_layer_tree(layer_id)

            # Return concatenated string of all contents
            return json_response('\n'.join([l.content for l in layer_tree]))
        elif action == "tree":
            layer_tree = _get_layer_tree(layer_id)

            return json_response(marshal(layer_tree, _get_layer_fields()))
        elif action == "tree_full":
            layer_tree = _get_layer_tree(layer_id)

            return json_response(marshal(layer_tree, _get_layer_details_fields()))
Beispiel #2
0
    def get(self):
        worker = celerycontrol.get_running_worker()
        worker_list = []

        for w in worker:
            worker_list.append({'hostname' : str(w)})

        return json_response(marshal(worker_list, _get_worker_fields()))
Beispiel #3
0
    def get(self, clouddef_id):
        inst = _get_cloud(clouddef_id)[0]

        cloud_dict = marshal(inst, _get_cloud_fields())

        if inst.cloudprovider_id == 1:
            try:
                # Try to get details off the details instance, otherwise only the main cloud info is returned
                details_inst = _get_cloudec2_query(inst.clouddef_id)[0]
                details_dict = marshal(details_inst, _get_ec2_fields())
                cloud_dict.update(details_dict)
            except (TypeError, NoResultFound):
                pass

        return json_response(cloud_dict)
Beispiel #4
0
 def get(self):
     with database.get_session() as session:
         inst = session.query(DataProvider).order_by(
             DataProvider.dataprovider_id).all()
         return json_response(marshal(inst, _get_dataprovidertype_fields()))
Beispiel #5
0
 def get(self):
     with database.get_session() as session:
         inst = session.query(CloudProvider).order_by(
             CloudProvider.name).all()
         return json_response(marshal(inst, _get_cloudtype_fields()))
Beispiel #6
0
    def get(self, **kwargs):
        req_id = kwargs[self.id_name]
        inst = self.get_func(req_id)[0]

        return json_response(marshal(inst, self.details_field_func()))
Beispiel #7
0
 def get(self):
     inst = self.get_all_func()
        
     return json_response(marshal(inst, self.list_field_func()))