Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Commit

Permalink
Ensure ports are integers when creating Rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Casey D committed Jan 18, 2016
1 parent f369aa4 commit 52c4bec
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion calico_containers/pycalico/datastore_datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,13 @@ def to_json_dict(self):
json_dict["dst_net"] = str(json_dict["dst_net"])
if "src_net" in json_dict:
json_dict["src_net"] = str(json_dict["src_net"])

# Convert ports to integers.
if "dst_ports" in json_dict:
json_dict["dst_ports"] = [int(p) for p in json_dict["dst_ports"]]
if "src_ports" in json_dict:
json_dict["src_ports"] = [int(p) for p in json_dict["src_ports"]]

return json_dict

def pprint(self):
Expand Down Expand Up @@ -472,4 +479,4 @@ def pprint(self):
if "dst_net" in self:
out.extend(["cidr", str(self["dst_net"])])

return " ".join(out)
return " ".join(out)

0 comments on commit 52c4bec

Please sign in to comment.