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

Commit

Permalink
Merge pull request #77 from caseydavenport/cd4-integer-ports
Browse files Browse the repository at this point in the history
Ensure ports are integers when creating Rule
  • Loading branch information
Casey Davenport committed Jan 18, 2016
2 parents f369aa4 + 52c4bec commit baf9712
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 baf9712

Please sign in to comment.