Skip to content

Commit

Permalink
Postgres does not like empty strings for type inet
Browse files Browse the repository at this point in the history
Check for empty string and explicitly set address to None

Fixes LP# 1112536

Change-Id: Ib6f1ca9ab4dd11a53e2ab8057664136166b4c616
  • Loading branch information
Davanum Srinivas committed Feb 1, 2013
1 parent c421d77 commit df4e4b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nova/db/sqlalchemy/api.py
Expand Up @@ -890,6 +890,11 @@ def floating_ip_get_by_address(context, address):

@require_context
def _floating_ip_get_by_address(context, address, session=None):

# if address string is empty explicitly set it to None
if not address:
address = None

result = model_query(context, models.FloatingIp, session=session).\
filter_by(address=address).\
first()
Expand Down

0 comments on commit df4e4b6

Please sign in to comment.