Can't update firewall
rvanlaar opened this issue · 4 comments
rvanlaar commented
Hi,
Thanks for this product. Unfortunately I have to work around some quirks.
What I want:
As a member of a devops team I want to be able to programmatically update firewall records.
What happens:
I can only create, read and delete firewalls. The API does allow this:
https://developers.digitalocean.com/documentation/v2/#update-a-firewall
rvanlaar commented
Adding this function to the Firewall class made me able to update my firewalls.
def update(self, *args, **kwargs):
inbound = jsonpickle.encode(self.inbound_rules, unpicklable=False)
outbound = jsonpickle.encode(self.outbound_rules, unpicklable=False)
params = {'name': self.name,
'droplet_ids': self.droplet_ids,
'inbound_rules': jsonpickle.decode(inbound),
'outbound_rules': jsonpickle.decode(outbound),
'tags': self.tags}
data = self.get_data('firewalls/%s' % (self.id), type=PUT, params=params)
if data:
self._set_firewall_attributes(data)
return self
koalalorenzo commented
Would you like to update the source code with a PR (with relative tests to ensure that this is happening properly?) That would help a lot!
rvanlaar commented
I can put it on my todo list. I don't think I'll have time for this.
koalalorenzo commented
Closing for inactivity