def get(self, *args, **kwargs): """ Lists dhcprelay ipv4 entry. """ dhcprelay_id = kwargs['dhcprelay_id'] dhcprelayipv4_obj = DHCPRelayIPv4.get_by_pk(id=dhcprelay_id) serializer_options = DHCPRelayIPv4Serializer(dhcprelayipv4_obj, many=False) return Response(serializer_options.data)
def delete_dhcprelayipv4(user, dhcprelayipv4_id): dhcprelayipv4_obj = DHCPRelayIPv4.get_by_pk(id=dhcprelayipv4_id) with distributedlock(LOCK_NETWORK_IPV4 % dhcprelayipv4_obj.networkipv4.id): if not dhcprelayipv4_obj.networkipv4.active: dhcprelayipv4_obj.delete() return True else: raise exceptions.CannotRemoveDHCPRelayFromActiveNetwork()
def delete_dhcprelayipv4(user, dhcprelayipv4_id): dhcprelayipv4_obj = DHCPRelayIPv4.get_by_pk(id=dhcprelayipv4_id) with distributedlock(LOCK_NETWORK_IPV4 % dhcprelayipv4_obj.networkipv4.id): if not dhcprelayipv4_obj.networkipv4.active: dhcprelayipv4_obj.delete() return True else: raise exceptions.CannotRemoveDHCPRelayFromActiveNetwork()
def get(self, *args, **kwargs): '''Lists dhcprelay ipv4 entry ''' dhcprelay_id = kwargs['dhcprelay_id'] dhcprelayIPv4_obj = DHCPRelayIPv4.get_by_pk(id=dhcprelay_id) serializer_options = DHCPRelayIPv4Serializer( dhcprelayIPv4_obj, many=False ) return Response(serializer_options.data)