mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #37644 from Ch3LL/fix_37643
digital ocean list_keypairs: increase limit for ssh keys parsed
This commit is contained in:
commit
e1e8b81d16
@ -617,22 +617,34 @@ def list_keypairs(call=None):
|
|||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
items = query(method='account/keys')
|
fetch = True
|
||||||
|
page = 1
|
||||||
ret = {}
|
ret = {}
|
||||||
for key_pair in items['ssh_keys']:
|
|
||||||
name = key_pair['name']
|
while fetch:
|
||||||
if name in ret:
|
items = query(method='account/keys', command='?page=' + str(page) +
|
||||||
raise SaltCloudSystemExit(
|
'&per_page=100')
|
||||||
'A duplicate key pair name, \'{0}\', was found in DigitalOcean\'s '
|
|
||||||
'key pair list. Please change the key name stored by DigitalOcean. '
|
for key_pair in items['ssh_keys']:
|
||||||
'Be sure to adjust the value of \'ssh_key_file\' in your cloud '
|
name = key_pair['name']
|
||||||
'profile or provider configuration, if necessary.'.format(
|
if name in ret:
|
||||||
name
|
raise SaltCloudSystemExit(
|
||||||
|
'A duplicate key pair name, \'{0}\', was found in DigitalOcean\'s '
|
||||||
|
'key pair list. Please change the key name stored by DigitalOcean. '
|
||||||
|
'Be sure to adjust the value of \'ssh_key_file\' in your cloud '
|
||||||
|
'profile or provider configuration, if necessary.'.format(
|
||||||
|
name
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
ret[name] = {}
|
||||||
ret[name] = {}
|
for item in six.iterkeys(key_pair):
|
||||||
for item in six.iterkeys(key_pair):
|
ret[name][item] = str(key_pair[item])
|
||||||
ret[name][item] = str(key_pair[item])
|
|
||||||
|
page += 1
|
||||||
|
try:
|
||||||
|
fetch = 'next' in items['links']['pages']
|
||||||
|
except KeyError:
|
||||||
|
fetch = False
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user