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

Added Conditional to check if disk should be brought online. #268

Merged
merged 3 commits into from
Aug 23, 2021

Conversation

bateskevin
Copy link
Contributor

SUMMARY

This fixes a bug where if you want to bring a disk offline by using the parameter "online" set to "false/no" it would bring the disk online again anyways. All needed is the added conditional to fix this, where the parameter gets taken in to account at the end.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

win_initialize_disk

ADDITIONAL INFORMATION
Code used
- name: Take disk offline bases on UUID
      win_initialize_disk:
        uniqueid: "DiskUUID"
        online: no
        force: yes
Expected behaviour

We expected the Disk to be taken offline (and staying offline) after the ansible run.

Actual behaviour

The disk was shortly taken offline, but then brought back online by the line we fixed in the module.

This fixes a bug where if you want to bring a disk offline by using the parameter "online" set to "false/no" it would bring the disk online again anyways. All needed is the added conditional to fix this, where the parameter gets taken in to account at the end.
@jborean93
Copy link
Collaborator

Doesn't the change here mean the disk is no longer initialised? Wouldn't the better method be to just take the disk back offline once it is initialized?

@bateskevin
Copy link
Contributor Author

Hi @jborean93,

Thanks for your reply!

But in the case of $bring_online being set to false we do not want it to be online. Is there maybe a misunderstanding on our side here?

In the Ansible Playbook we specifically set 'online' to 'no'/'false'. This gets ignored without the conditional we commited.

Kind regards,
Kevin

@jborean93
Copy link
Collaborator

My apologies (and sorry for the delay in replying). After thinking about it before my concerns doesn't seem to be valid. I've pushed a commit that adds a changelog fragment but everything else looks good to me.

@jborean93 jborean93 merged commit c303637 into ansible-collections:main Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants