def delete(self, req, id): context = req.environ['engine.context'] self.compute_api.ensure_default_security_group(context) try: id = int(id) rule = db.security_group_rule_get(context, id) except ValueError: msg = _("Rule id is not integer") raise exc.HTTPBadRequest(explanation=msg) except exception.NotFound as exp: msg = _("Rule (%s) not found") % id raise exc.HTTPNotFound(explanation=msg) group_id = rule.parent_group_id self.compute_api.ensure_default_security_group(context) security_group = db.security_group_get(context, group_id) msg = _("Revoke security group ingress %s") LOG.audit(msg, security_group['name'], context=context) db.security_group_rule_destroy(context, rule['id']) self.compute_api.trigger_security_group_rules_refresh(context, security_group_id=security_group['id']) return webob.Response(status_int=202)
def delete(self, req, id): context = req.environ["engine.context"] rule = sqlalchemy_api.security_group_rule_get(context, id) if not rule: raise exception.ApiError(_("Rule not found")) group_id = rule.parent_group_id self.compute_api.ensure_default_security_group(context) security_group = db.security_group_get(context, group_id) if not security_group: raise exception.SecurityGroupNotFound(security_group_id=group_id) msg = "Revoke security group ingress %s" LOG.audit(_(msg), security_group["name"], context=context) db.security_group_rule_destroy(context, rule["id"]) self.compute_api.trigger_security_group_rules_refresh(context, security_group_id=security_group["id"]) return exc.HTTPAccepted()
def delete(self, req, id): context = req.environ['engine.context'] rule = sqlalchemy_api.security_group_rule_get(context, id) if not rule: raise exception.ApiError(_("Rule not found")) group_id = rule.parent_group_id self.compute_api.ensure_default_security_group(context) security_group = db.security_group_get(context, group_id) if not security_group: raise exception.SecurityGroupNotFound(security_group_id=group_id) msg = "Revoke security group ingress %s" LOG.audit(_(msg), security_group['name'], context=context) db.security_group_rule_destroy(context, rule['id']) self.compute_api.trigger_security_group_rules_refresh( context, security_group_id=security_group['id']) return exc.HTTPAccepted()