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
This commit is contained in:
parent
3f9316bca2
commit
01f4081b66
2 changed files with 5 additions and 1 deletions
|
@ -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)
|
self.module.exit_json(changed=False, data=droplet_data)
|
||||||
if self.module.check_mode:
|
if self.module.check_mode:
|
||||||
self.module.exit_json(changed=True)
|
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
|
json_data = response.json
|
||||||
if response.status_code >= 400:
|
if response.status_code >= 400:
|
||||||
self.module.fail_json(changed=False, msg=json_data['message'])
|
self.module.fail_json(changed=False, msg=json_data['message'])
|
||||||
|
|
Loading…
Reference in a new issue