Exemplo n.º 1
0
 def get_object(self):
     try:
         # Get initial profile information
         profile_id = self.kwargs["profile_id"]
         profile = senlin.profile_get(self.request, profile_id)
         # Metadata in update form should be empty rather than {}
         if not profile.metadata:
             metadata = None
         else:
             metadata = yaml.safe_dump(
                 profile.metadata,
                 default_flow_style=False)
         profile_dict = {"profile_id": profile_id,
                         "name": profile.name,
                         "type": profile.type_name,
                         "spec": yaml.safe_dump(
                             profile.spec,
                             default_flow_style=False),
                         "metadata": metadata
                         }
     except Exception:
         msg = _("Unable to retrieve profile.")
         url = reverse_lazy(profiles_forms.INDEX_URL)
         exceptions.handle(self.request, msg, redirect=url)
     return profile_dict
Exemplo n.º 2
0
 def get_object(self):
     try:
         # Get initial profile information
         profile_id = self.kwargs["profile_id"]
         profile = senlin.profile_get(self.request, profile_id)
         # Metadata in update form should be empty rather than {}
         if not profile.metadata:
             metadata = None
         else:
             metadata = yaml.safe_dump(
                 profile.metadata,
                 default_flow_style=False)
         profile_dict = {"profile_id": profile_id,
                         "name": profile.name,
                         "type": profile.type,
                         "spec": yaml.safe_dump(
                             profile.spec,
                             default_flow_style=False),
                         "metadata": metadata
                         }
     except Exception:
         msg = _("Unable to retrieve profile.")
         url = reverse_lazy(profiles_forms.INDEX_URL)
         exceptions.handle(self.request, msg, redirect=url)
     return profile_dict
Exemplo n.º 3
0
    def get(self, request, profile_id):
        """Get a single profile's details with the profile id.

        The following get parameters may be passed in the GET

        :param profile_id: the id of the profile

        The result is a profile object.
        """
        return senlin.profile_get(request, profile_id).to_dict()
Exemplo n.º 4
0
    def get(self, request, profile_id):
        """Get a single profile's details with the profile id.

        The following get parameters may be passed in the GET

        :param profile_id: the id of the profile

        The result is a profile object.
        """
        profile = senlin.profile_get(request, profile_id).to_dict()
        profile["spec"] = api_utils.convert_to_yaml(profile["spec"])
        profile["metadata"] = api_utils.convert_to_yaml(profile["metadata"])
        return profile
Exemplo n.º 5
0
 def get_object(self):
     try:
         # Get initial profile information
         profile_id = self.kwargs["profile_id"]
         profile = senlin.profile_get(self.request, profile_id)
         profile.profile_id = profile_id
         profile.profile_spec = yaml.safe_dump(profile.spec,
                                               default_flow_style=False)
         profile.profile_metadata = yaml.safe_dump(profile.metadata,
                                                   default_flow_style=False)
     except Exception:
         msg = _("Unable to retrieve profile.")
         url = reverse_lazy(profiles_forms.INDEX_URL)
         exceptions.handle(self.request, msg, redirect=url)
     return profile
Exemplo n.º 6
0
 def get_object(self):
     try:
         # Get initial profile information
         profile_id = self.kwargs["profile_id"]
         profile = senlin.profile_get(self.request, profile_id)
         profile.profile_id = profile_id
         profile.profile_spec = yaml.safe_dump(profile.spec,
                                               default_flow_style=False)
         profile.profile_metadata = yaml.safe_dump(profile.metadata,
                                                   default_flow_style=False)
     except Exception:
         msg = _("Unable to retrieve profile.")
         url = reverse_lazy(profiles_forms.INDEX_URL)
         exceptions.handle(self.request, msg, redirect=url)
     return profile