Fix creation of DigitalOcean droplets using digital_ocean_droplet module (#61655)

* Omit disallowed 'id' attribute in request body to create a droplet

* Add changelog fragment for PR #61655
pull/61818/head
Mark Chesney 5 years ago committed by Toshio Kuratomi
parent 4cc9ee950f
commit 9ff8d8d898

@ -0,0 +1,2 @@
bugfixes:
- digital_ocean_droplet - Fix creation of DigitalOcean droplets using digital_ocean_droplet module (https://github.com/ansible/ansible/pull/61655)

@ -252,7 +252,9 @@ class DODroplet(object):
self.module.exit_json(changed=False, data=droplet_data)
if self.module.check_mode:
self.module.exit_json(changed=True)
response = self.rest.post('droplets', data=self.module.params)
request_params = dict(self.module.params)
del request_params['id']
response = self.rest.post('droplets', data=request_params)
json_data = response.json
if response.status_code >= 400:
self.module.fail_json(changed=False, msg=json_data['message'])

Loading…
Cancel
Save