Esempio n. 1
0
 def get_object(self):
     try:
         # Get policy information
         policy_id = self.kwargs["policy_id"]
         policy = senlin.policy_get(self.request, policy_id)
         policy.policy_spec = yaml.safe_dump(policy.spec,
                                             default_flow_style=False)
     except Exception:
         msg = _("Unable to retrieve policy.")
         url = reverse_lazy(policies_forms.INDEX_URL)
         exceptions.handle(self.request, msg, redirect=url)
     return policy
Esempio n. 2
0
 def get_object(self):
     try:
         # Get initial policy information
         policy_id = self.kwargs["policy_id"]
         policy = senlin.policy_get(self.request, policy_id)
         policy_dict = {"policy_id": policy_id,
                        "name": policy.name}
     except Exception:
         msg = _("Unable to retrieve policy.")
         url = reverse_lazy(policies_forms.INDEX_URL)
         exceptions.handle(self.request, msg, redirect=url)
     return policy_dict