Merge pull request #25438 from rallytime/do_v2

Reduce digital_ocean_v2 API call frequency
This commit is contained in:
Thomas S Hatch 2015-07-15 13:40:18 -06:00
commit 146a81b7c3
2 changed files with 16 additions and 3 deletions

View file

@ -0,0 +1,13 @@
===========================
Salt 2015.5.4 Release Notes
===========================
:release: TBA
Version 2015.5.4 is a bugfix release for :doc:`2015.5.0
</topics/releases/2015.5.0>`.
Changes:
- When querying for VMs in ``ditigal_ocean_v2.py``, the number of VMs to include in a page was changed from 20
(default) to 200 to reduce the number of API calls to Digital Ocean.

View file

@ -112,7 +112,7 @@ def avail_images(call=None):
ret = {}
while fetch:
items = query(method='images', command='?page=' + str(page))
items = query(method='images', command='?page=' + str(page) + '&per_page=200')
for image in items['images']:
ret[image['id']] = {}
@ -162,7 +162,7 @@ def list_nodes(call=None):
ret = {}
while fetch:
items = query(method='droplets', command='?page=' + str(page))
items = query(method='droplets', command='?page=' + str(page) + '&per_page=200')
for node in items['droplets']:
ret[node['name']] = {
'id': node['id'],
@ -194,7 +194,7 @@ def list_nodes_full(call=None, forOutput=True):
ret = {}
while fetch:
items = query(method='droplets', command='?page=' + str(page))
items = query(method='droplets', command='?page=' + str(page) + '&per_page=200')
for node in items['droplets']:
ret[node['name']] = {}
for item in node.keys():