Example #1
0
 def _ensure_update_firewall_group(self, context, fwg_id):
     fwg = self.get_firewall_group(context, fwg_id)
     if fwg['status'] in [nl_constants.PENDING_CREATE,
                          nl_constants.PENDING_UPDATE,
                          nl_constants.PENDING_DELETE]:
         raise f_exc.FirewallGroupInPendingState(firewall_id=fwg_id,
                                             pending_state=fwg['status'])
    def _ensure_update_firewall_group(self, context, fwg_id):
        """Checks if the firewall group can be updated

        Raises FirewallGroupInPendingState if the firewall group is in pending
        state.
        :param context: neutron context
        :param fwg_id: firewall group ID to check
        :return: Firewall group dict
        """
        fwg = self.get_firewall_group(context, fwg_id)
        if fwg['status'] in [nl_constants.PENDING_CREATE,
                             nl_constants.PENDING_UPDATE,
                             nl_constants.PENDING_DELETE]:
            raise f_exc.FirewallGroupInPendingState(
                firewall_id=fwg_id, pending_state=fwg['status'])
        return fwg