Пример #1
0
 def get_object(self):
     try:
         # Get initial node information
         node_id = self.kwargs["node_id"]
         node = senlin.node_get(self.request, node_id)
     except Exception:
         msg = _("Unable to retrieve node.")
         url = reverse_lazy("horizon:cluster:nodes:index")
         exceptions.handle(self.request, msg, redirect=url)
     return node
Пример #2
0
 def get_object(self):
     try:
         # Get initial node information
         node_id = self.kwargs["node_id"]
         node = senlin.node_get(self.request, node_id)
     except Exception:
         msg = _("Unable to retrieve node.")
         url = reverse_lazy("horizon:cluster:nodes:index")
         exceptions.handle(self.request, msg, redirect=url)
     return node
Пример #3
0
    def get(self, request, node_id):
        """Get a single node's details with the receiver id.

        The following get parameters may be passed in the GET

        :param node_id: the id of the node

        The result is a node object.
        """
        node = senlin.node_get(request, node_id).to_dict()
        node["metadata"] = api_utils.convert_to_yaml(node["metadata"])
        return node
Пример #4
0
    def get(self, request, node_id):
        """Get a single node's details with the receiver id.

        The following get parameters may be passed in the GET

        :param node_id: the id of the node

        The result is a node object.
        """
        node = senlin.node_get(request, node_id).to_dict()
        node["metadata"] = api_utils.convert_to_yaml(node["metadata"])
        return node
Пример #5
0
    def get_object(self):
        try:
            # Get initial node information
            node_id = self.kwargs["node_id"]
            node = senlin.node_get(self.request, node_id)
            # Metadata in update form should be empty rather than {}
            if not node.metadata:
                metadata = None
            else:
                metadata = yaml.safe_dump(
                    node.metadata,
                    default_flow_style=False)
            node_dict = {"node_id": node_id,
                         "name": node.name,
                         "profile_id": node.profile_id,
                         "role": node.role,
                         "metadata": metadata}

        except Exception:
            msg = _("Unable to retrieve node.")
            url = reverse_lazy("horizon:cluster:nodes:index")
            exceptions.handle(self.request, msg, redirect=url)
        return node_dict
Пример #6
0
    def get_object(self):
        try:
            # Get initial node information
            node_id = self.kwargs["node_id"]
            node = senlin.node_get(self.request, node_id)
            # Metadata in update form should be empty rather than {}
            if not node.metadata:
                metadata = None
            else:
                metadata = yaml.safe_dump(node.metadata,
                                          default_flow_style=False)
            node_dict = {
                "node_id": node_id,
                "name": node.name,
                "profile_id": node.profile_id,
                "role": node.role,
                "metadata": metadata
            }

        except Exception:
            msg = _("Unable to retrieve node.")
            url = reverse_lazy("horizon:cluster:nodes:index")
            exceptions.handle(self.request, msg, redirect=url)
        return node_dict