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/61655/merge
Mark Chesney 5 years ago committed by ansibot
parent 3f9316bca2
commit 01f4081b66

@ -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