Trying to get an IP Address using the advanced library always returns an empty response (204)

If I try to retrieve (refresh) an IP Address using the advanced library, I always get a "204 returned" error message.

SOLIDserver version: 6.0.2.P3a amd64

Steps to reproduce:

from SOLIDserverRest import adv as sdsadv
sds = sdsadv.SDS(ip_address="your_ip",
                 user="your_user",
                 pwd="your_pass")
sds.connect(method="native")
ip = sdsadv.IpAddress(sds=sds, ipv4="10.211.132.72")
ip.refresh()

Response:

SOLIDserverRest.Exception.SDSIpAddressNotFoundError: ip not found: cannot get ip addr id / ip not found: cannot found object by ip addr 10.211.132.72 / empty answer: 204 returned

Using the query function gives me the same result:

from SOLIDserverRest import adv as sdsadv
sds = sdsadv.SDS(ip_address="your_ip",
                 user="your_user",
                 pwd="your_pass")
sds.connect(method="native")
where = {"WHERE": "hostaddr='10.211.132.72'"}
sds.query("ip_address_list", params=where)

Response: SOLIDserverRest.Exception.SDSEmptyError: empty answer: 204 returned

If I use the 'ip_addr' parameter instead (in hexadecimal format), it works:

from SOLIDserverRest import adv as sdsadv
sds = sdsadv.SDS(ip_address="your_ip",
                 user="your_user",
                 pwd="your_pass")
sds.connect(method="native")
where = {"WHERE": "ip_addr='0ad38448'"}
sds.query("ip_address_list", params=where)

Response: [{'errno': '0', 'type': 'ip', 'free_start_ip_addr': '0ad38448', 'free_end_ip_addr': '0ad38448', 'free_scope_size': '0', 'ip_id': '188', 'site_is_template': '0', 'site_name': 'Interne', ...}]

It seems we cannot filter the result by 'hostaddr'. The error comes from this function (in 'https://gitlab.com/efficientip/solidserverrest/-/blob/master/SOLIDserverRest/adv/ipaddress.py'):

    # -------------------------------------
    def get_id_by_ipaddr(self, ipaddr):
        """get the ID from its ip addr, return None if non existant"""

        params = {
            "WHERE": "hostaddr='{}'".format(ipaddr),
            "limit": 1,
            **self.additional_params
        }

        try:
            rjson = self.sds.query('ip_address_list',
                                   params=params)
        except SDSError as err_descr:
            msg = "cannot found object by ip addr {}".format(ipaddr)
            msg += " / "+str(err_descr)
            raise SDSIpAddressNotFoundError(msg)

        if rjson[0]['errno'] != '0':  # pragma: no cover
            raise SDSError("errno raised on get id by addr")

        return rjson[0]['ip_id']
Edited by Eric Jacob