Skip to content

Commit

Permalink
bugfix - checksum digital ocean
Browse files Browse the repository at this point in the history
  • Loading branch information
Signorini committed Feb 5, 2019
1 parent 6694ef2 commit 3d85e0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions app/services/rules/digitalocean.py
@@ -1,6 +1,6 @@

from .ruler import Ruler
from pydash.objects import pick_by
from pydash.objects import pick_by, omit
from pydash.utilities import identity

class RulerDigitalOcean(Ruler):
Expand Down Expand Up @@ -89,4 +89,10 @@ def fctPublicIp(source, batch):

for net in ips:
if net['type'] == 'public':
return net['ip_address']
return net['ip_address']

@staticmethod
def checksum(source, batch):
batch = omit(batch, ['checksum', 'backup_ids', 'next_backup_window'])
dsort = OrderedDict(sorted(batch.items(), key=lambda x: x[0]))
return sha1(repr(dsort).encode('utf-8')).hexdigest()
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -53,7 +53,7 @@ python-dateutil==2.7.2
python-digitalocean==1.14.0
python-dotenv==0.8.2
pytz==2018.4
PyYAML==3.12
PyYAML==4.2b1
requests==2.21.0
requests-oauthlib==1.1.0
requestsexceptions==1.4.0
Expand Down

0 comments on commit 3d85e0d

Please sign in to comment.