Skip to content

Commit

Permalink
Add assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
cygnusb committed Nov 3, 2018
1 parent 33df4aa commit d119c30
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pypureomapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,9 @@ def lookup(self, ltype, rvalues=[], ip=None, mac=None, name=None):
could be found or the object lacks an ip address or mac
@raises socket.error:
"""
msg = OmapiMessage.open(ltype.encode('utf-8'))
ltype_utf = ltype.encode("utf-8")
assert ltype_utf in [b"host", b"lease"]
msg = OmapiMessage.open(ltype_utf)
if ip:
msg.obj.append((b"ip-address", pack_ip(ip)))
if mac:
Expand Down

0 comments on commit d119c30

Please sign in to comment.