Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent update removed "Ipv4Addr" field from RecordHost (now HostRecord) #59

Closed
eest opened this issue May 16, 2018 · 10 comments
Closed

Comments

@eest
Copy link
Contributor

eest commented May 16, 2018

Hello,

I tried updating to 0.6.0 and it broke my code. The initial problem was that Host record related structs had been renamed from "RecordHost[...]" to "HostRecord[...]". While I guess that "HostRecord" reads a bit more naturally it's a bit strange since all other record types are still called "RecordA", "RecordCNAME" etc.

I can live with that change, but I also noticed the now renamed HostRecord struct no longer contains the field "Ipv4Addr". I have been using that to search for hosts by IP address like so:

var hostResult []ibclient.RecordHost

recordHostObj := ibclient.NewRecordHost(ibclient.RecordHost{
    Ipv4Addr: ip,
})

err := conn.GetObject(recordHostObj, "", &hostResult)

This of course no longer works. Was this removed on purpose and I am supposed to fill in an Ipv4Addrs slice instead or should it be added back?

Pinging @saiprasannasastry and @jkraj since you were involved in changing the code.

@jkraj
Copy link
Contributor

jkraj commented May 17, 2018

@eest Yes it is modified intentionally. Present structure represents actual wapi object representation. So you should use Ipv4Addrs slice.

@eest
Copy link
Contributor Author

eest commented May 17, 2018

@jkraj Thanks for the input. I have tried using a slice instead like so:

recordHostObj := ibclient.NewHostRecord(ibclient.HostRecord{
    Ipv4Addrs: []ibclient.HostRecordIpv4Addr{
        *ibclient.NewHostRecordIpv4Addr(ibclient.HostRecordIpv4Addr{
            Ipv4Addr: address,
        }),
    },
})
err = conn.GetObject(recordHostObj, "", &hostResult)

... which compiles, but the search fails because the field is not searchable:

2018/05/17 09:16:19 GetObject request error: 'WAPI request error: 400('400 Bad Request')
Contents:
{ "Error": "AdmConProtoError: Field is not searchable: ipv4addrs", 
  "code": "Client.Ibap.Proto", 
  "text": "Field is not searchable: ipv4addrs"
}

Am I doing something wrong or is the Ipv4Addrs field searchable in later WAPI versions?

@chinmayb
Copy link
Contributor

Looks like we need to keep "Ipv4addr" field along with "Ipv4addrs" as well @jkraj . If you see the doc "wapidoc/objects/record.host.html#ipv4addr" Ipv4addr of string type is searchable, while ipv4addrs is not.

@chinmayb
Copy link
Contributor

chinmayb commented May 30, 2018

The below PR has a fix. Will that work for you @eest ?
#70

@eest
Copy link
Contributor Author

eest commented May 31, 2018

@chinmayb: I applied the diff to my 0.6.0 branch and it made my search work, thanks!

@eest
Copy link
Contributor Author

eest commented May 31, 2018

I noticed #69 has been merged, it would be great if you could create a new tag when this is also solved so i have a version that supports both host searching by ip address and the FixedAddress name addition from 0.5.0 :).

@chinmayb
Copy link
Contributor

@eest you can use 0.7.0 version.

@eest
Copy link
Contributor Author

eest commented Jun 1, 2018

@chinmayb: I can not, because 0.7.0 does not include the fix for FixedAddress added in #69.

@chinmayb
Copy link
Contributor

chinmayb commented Jun 3, 2018

I had updated the tag by force pushing. It didnt seem to work. I created a new release v0.7.1. Please use that

@eest
Copy link
Contributor Author

eest commented Jun 4, 2018

@chinmayb the 0.7.1 tag seems to work as expected, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants