Skip to content

Commit b49046d

Browse files
author
Elias Nygren
committed
remove unnecessary check from firewall, add comment attribute
1 parent 2ee612b commit b49046d

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

upcloud_api/firewall.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class FirewallRule(object):
1818
'action': 'drop',
1919
'direction': 'in',
2020
'family': 'IPv4',
21+
'comment': '',
2122
'destination_address_end': None,
2223
'destination_address_start': None,
2324
'destination_port_end': None,
@@ -40,9 +41,6 @@ def __init__(self, **kwargs):
4041

4142
# set object attributes from params
4243
for key in kwargs:
43-
if key not in self.attributes:
44-
self._invalid_key_err(key)
45-
4644
setattr(self, key, kwargs[key])
4745

4846
# set defaults (if need be) where the default is not None
@@ -82,16 +80,6 @@ def destroy(self):
8280
)
8381

8482

85-
def _invalid_key_err(self, key):
86-
"""
87-
Raise exception on invalid parameters given to __init__.
88-
"""
89-
attr_list = list(self.attributes.keys())
90-
raise Exception(
91-
"invalid parameter to FirewallRule, '{key}' is not in {attributes}"
92-
.format(key=key, attributes=attr_list)
93-
)
94-
9583
def _associate_with_server(self, server):
9684
"""
9785
Internal function used by Server to associate itself with the FirewallRule.

0 commit comments

Comments
 (0)