Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DigitalOcean Block Storage Not Idempotent (when detaching) #149

Closed
lucasbasquerotto opened this issue Aug 30, 2021 · 3 comments · Fixed by #154
Closed

DigitalOcean Block Storage Not Idempotent (when detaching) #149

lucasbasquerotto opened this issue Aug 30, 2021 · 3 comments · Fixed by #154
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@lucasbasquerotto
Copy link
Contributor

SUMMARY

The DigitalOcean Block Storage module is NOT idempotent when detaching (creating, destroying and attaching are idempotent).

ISSUE TYPE
  • Bug Report
COMPONENT NAME

digital_ocean_block_storage

ANSIBLE VERSION
ansible [core 2.11.3] 
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.10 (default, Jun  2 2021, 10:49:15) [GCC 9.4.0]
  jinja version = 3.0.1
  libyaml = True
COLLECTION VERSION
Collection             Version
---------------------- -------
community.digitalocean 1.8.0 
CONFIGURATION

(no output)

OS / ENVIRONMENT

Ubuntu 20.04 in a Docker Containe running inside WSL2 (Ubuntu 20.04 image, Windows10 host)

STEPS TO REPRODUCE
# idempotent
- community.digitalocean.digital_ocean_block_storage:
    command: create
    state: present
    oauth_token: "API_KEY"
    volume_name: vol01
    region: ams3
    block_size: 10

# idempotent
- community.digitalocean.digital_ocean_block_storage:
    command: create
    state: absent
    oauth_token: "API_KEY"
    volume_name: vol01
    region: ams3

# idempotent
- community.digitalocean.digital_ocean_block_storage:
    command: attach
    state: present
    oauth_token: "API_KEY"
    volume_name: vol01
    region: ams3
    droplet_id: "droplet1"

# NOT idempotent
# after 1st time:
# error detaching volume from droplet: volume is not attached to droplet
- community.digitalocean.digital_ocean_block_storage:
    command: attach
    state: absent
    oauth_token: "API_KEY"
    volume_name: vol01
    region: ams3
    droplet_id: "droplet1"
EXPECTED RESULTS

Each command should be able to be executed in isolation several times consecutively without errors.

ACTUAL RESULTS

The last example (detaching a volume from a droplet) works only the first time, giving the error error detaching volume from droplet: volume is not attached to droplet from the 2nd time it runs onward, making the module not idempotent.

@mamercad mamercad added bug Something isn't working good first issue Good for newcomers labels Aug 31, 2021
@mamercad mamercad self-assigned this Sep 4, 2021
@mamercad
Copy link
Collaborator

mamercad commented Sep 4, 2021

@lucasbasquerotto Want to give this a shot?

@lucasbasquerotto
Copy link
Contributor Author

@mamercad Thanks for the fix! I tested the PR here and it worked.

@mamercad
Copy link
Collaborator

mamercad commented Sep 6, 2021

Sweet, thanks for testing, should land in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants