Skip to content

Commit

Permalink
Merge pull request #27 from clusto/ips-bugfix
Browse files Browse the repository at this point in the history
Fixes the resource manager asking for another arg in get_ips, previously only in ipmanager. Also fix up pagination.
  • Loading branch information
thekad committed Sep 23, 2015
2 parents 83bf57d + 162150b commit 39744df
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions clustoapi/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ def expanded():
result['parents'] = [unclusto(x) for x in obj.parents()]
if isinstance(obj, clusto.drivers.resourcemanagers.ResourceManager):
result['count'] = obj.count

if 'get_ips' in dir(obj) and not obj.entity.type == 'ipmanager':
result['ips'] = obj.get_ips()
elif 'get_ips' in dir(obj):
result['ips'] = obj.get_ips()

return result

Expand Down Expand Up @@ -148,7 +147,10 @@ def page(ents, current=1, per=50):
last = 1

total = len(ents) / per
total = total + 1 if len(ents) % per else 0
# Add another page to the total if there is a remainder.
if len(ents) % per:
total += 1

return ents[first:last], total

def typecast(value, datatype, mask='%Y-%m-%dT%H:%M:%S.%f'):
Expand Down

0 comments on commit 39744df

Please sign in to comment.